| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/pcomplib.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | HASH_TABLE *prog_completes = (HASH_TABLE *) | - | ||||||||||||||||||||||||
| 18 | ((void *)0) | - | ||||||||||||||||||||||||
| 19 | ; | - | ||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||
| 21 | static void free_progcomp (void *); | - | ||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | COMPSPEC * | - | ||||||||||||||||||||||||
| 24 | compspec_create () | - | ||||||||||||||||||||||||
| 25 | { | - | ||||||||||||||||||||||||
| 26 | COMPSPEC *ret; | - | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | ret = (COMPSPEC *)sh_xmalloc((sizeof (COMPSPEC)), "pcomplib.c", 53); | - | ||||||||||||||||||||||||
| 29 | ret->refcount = 0; | - | ||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | ret->actions = (unsigned long)0; | - | ||||||||||||||||||||||||
| 32 | ret->options = (unsigned long)0; | - | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | ret->globpat = (char *) | - | ||||||||||||||||||||||||
| 35 | ((void *)0) | - | ||||||||||||||||||||||||
| 36 | ; | - | ||||||||||||||||||||||||
| 37 | ret->words = (char *) | - | ||||||||||||||||||||||||
| 38 | ((void *)0) | - | ||||||||||||||||||||||||
| 39 | ; | - | ||||||||||||||||||||||||
| 40 | ret->prefix = (char *) | - | ||||||||||||||||||||||||
| 41 | ((void *)0) | - | ||||||||||||||||||||||||
| 42 | ; | - | ||||||||||||||||||||||||
| 43 | ret->suffix = (char *) | - | ||||||||||||||||||||||||
| 44 | ((void *)0) | - | ||||||||||||||||||||||||
| 45 | ; | - | ||||||||||||||||||||||||
| 46 | ret->funcname = (char *) | - | ||||||||||||||||||||||||
| 47 | ((void *)0) | - | ||||||||||||||||||||||||
| 48 | ; | - | ||||||||||||||||||||||||
| 49 | ret->command = (char *) | - | ||||||||||||||||||||||||
| 50 | ((void *)0) | - | ||||||||||||||||||||||||
| 51 | ; | - | ||||||||||||||||||||||||
| 52 | ret->lcommand = (char *) | - | ||||||||||||||||||||||||
| 53 | ((void *)0) | - | ||||||||||||||||||||||||
| 54 | ; | - | ||||||||||||||||||||||||
| 55 | ret->filterpat = (char *) | - | ||||||||||||||||||||||||
| 56 | ((void *)0) | - | ||||||||||||||||||||||||
| 57 | ; | - | ||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | return executed 209 times by 1 test: ret;return ret;Executed by:
executed 209 times by 1 test: return ret;Executed by:
| 209 | ||||||||||||||||||||||||
| 60 | } | - | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | void | - | ||||||||||||||||||||||||
| 63 | compspec_dispose (cs) | - | ||||||||||||||||||||||||
| 64 | COMPSPEC *cs; | - | ||||||||||||||||||||||||
| 65 | { | - | ||||||||||||||||||||||||
| 66 | cs->refcount--; | - | ||||||||||||||||||||||||
| 67 | if (cs->refcount == 0
| 0-2 | ||||||||||||||||||||||||
| 68 | { | - | ||||||||||||||||||||||||
| 69 | do { if (cs->globpat
never executed: } while (0);sh_xfree((cs->globpat), "pcomplib.c", 78); | 0 | ||||||||||||||||||||||||
| 70 | do { if (cs->words
never executed: } while (0);sh_xfree((cs->words), "pcomplib.c", 79); | 0 | ||||||||||||||||||||||||
| 71 | do { if (cs->prefix
never executed: } while (0);sh_xfree((cs->prefix), "pcomplib.c", 80); | 0 | ||||||||||||||||||||||||
| 72 | do { if (cs->suffix
never executed: } while (0);sh_xfree((cs->suffix), "pcomplib.c", 81); | 0 | ||||||||||||||||||||||||
| 73 | do { if (cs->funcname
never executed: } while (0);sh_xfree((cs->funcname), "pcomplib.c", 82); | 0 | ||||||||||||||||||||||||
| 74 | do { if (cs->command
never executed: } while (0);sh_xfree((cs->command), "pcomplib.c", 83); | 0 | ||||||||||||||||||||||||
| 75 | do { if (cs->lcommand
never executed: } while (0);sh_xfree((cs->lcommand), "pcomplib.c", 84); | 0 | ||||||||||||||||||||||||
| 76 | do { if (cs->filterpat
never executed: } while (0);sh_xfree((cs->filterpat), "pcomplib.c", 85); | 0 | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | sh_xfree((cs), "pcomplib.c", 87); | - | ||||||||||||||||||||||||
| 79 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 80 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||
| 82 | COMPSPEC * | - | ||||||||||||||||||||||||
| 83 | compspec_copy (cs) | - | ||||||||||||||||||||||||
| 84 | COMPSPEC *cs; | - | ||||||||||||||||||||||||
| 85 | { | - | ||||||||||||||||||||||||
| 86 | COMPSPEC *new; | - | ||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | new = (COMPSPEC *)sh_xmalloc((sizeof (COMPSPEC)), "pcomplib.c", 97); | - | ||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | new->refcount = 1; | - | ||||||||||||||||||||||||
| 91 | new->actions = cs->actions; | - | ||||||||||||||||||||||||
| 92 | new->options = cs->options; | - | ||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | new->globpat = ((
| 0 | ||||||||||||||||||||||||
| 95 | ((void *)0) | - | ||||||||||||||||||||||||
| 96 | ); | - | ||||||||||||||||||||||||
| 97 | new->words = ((
| 0 | ||||||||||||||||||||||||
| 98 | ((void *)0) | - | ||||||||||||||||||||||||
| 99 | ); | - | ||||||||||||||||||||||||
| 100 | new->prefix = ((
| 0 | ||||||||||||||||||||||||
| 101 | ((void *)0) | - | ||||||||||||||||||||||||
| 102 | ); | - | ||||||||||||||||||||||||
| 103 | new->suffix = ((
| 0 | ||||||||||||||||||||||||
| 104 | ((void *)0) | - | ||||||||||||||||||||||||
| 105 | ); | - | ||||||||||||||||||||||||
| 106 | new->funcname = ((
| 0 | ||||||||||||||||||||||||
| 107 | ((void *)0) | - | ||||||||||||||||||||||||
| 108 | ); | - | ||||||||||||||||||||||||
| 109 | new->command = ((
| 0 | ||||||||||||||||||||||||
| 110 | ((void *)0) | - | ||||||||||||||||||||||||
| 111 | ); | - | ||||||||||||||||||||||||
| 112 | new->lcommand = ((
| 0 | ||||||||||||||||||||||||
| 113 | ((void *)0) | - | ||||||||||||||||||||||||
| 114 | ); | - | ||||||||||||||||||||||||
| 115 | new->filterpat = ((
| 0 | ||||||||||||||||||||||||
| 116 | ((void *)0) | - | ||||||||||||||||||||||||
| 117 | ); | - | ||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | return never executed: new;return new;never executed: return new; | 0 | ||||||||||||||||||||||||
| 120 | } | - | ||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | void | - | ||||||||||||||||||||||||
| 123 | progcomp_create () | - | ||||||||||||||||||||||||
| 124 | { | - | ||||||||||||||||||||||||
| 125 | if (prog_completes == 0
| 0-2 | ||||||||||||||||||||||||
| 126 | prog_completes = hash_create (256); executed 2 times by 1 test: prog_completes = hash_create (256);Executed by:
| 2 | ||||||||||||||||||||||||
| 127 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | int | - | ||||||||||||||||||||||||
| 130 | progcomp_size () | - | ||||||||||||||||||||||||
| 131 | { | - | ||||||||||||||||||||||||
| 132 | return never executed: (((prog_completes) ? (prog_completes)->nentries : 0));return (((prog_completes) ? (prog_completes)->nentries : 0));never executed: return (((prog_completes) ? (prog_completes)->nentries : 0)); | 0 | ||||||||||||||||||||||||
| 133 | } | - | ||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | static void | - | ||||||||||||||||||||||||
| 136 | free_progcomp (data) | - | ||||||||||||||||||||||||
| 137 | void * data; | - | ||||||||||||||||||||||||
| 138 | { | - | ||||||||||||||||||||||||
| 139 | COMPSPEC *cs; | - | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | cs = (COMPSPEC *)data; | - | ||||||||||||||||||||||||
| 142 | compspec_dispose (cs); | - | ||||||||||||||||||||||||
| 143 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||
| 145 | void | - | ||||||||||||||||||||||||
| 146 | progcomp_flush () | - | ||||||||||||||||||||||||
| 147 | { | - | ||||||||||||||||||||||||
| 148 | if (prog_completes
| 0 | ||||||||||||||||||||||||
| 149 | hash_flush (prog_completes, free_progcomp); never executed: hash_flush (prog_completes, free_progcomp); | 0 | ||||||||||||||||||||||||
| 150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | void | - | ||||||||||||||||||||||||
| 153 | progcomp_dispose () | - | ||||||||||||||||||||||||
| 154 | { | - | ||||||||||||||||||||||||
| 155 | if (prog_completes
| 0 | ||||||||||||||||||||||||
| 156 | hash_dispose (prog_completes); never executed: hash_dispose (prog_completes); | 0 | ||||||||||||||||||||||||
| 157 | prog_completes = (HASH_TABLE *) | - | ||||||||||||||||||||||||
| 158 | ((void *)0) | - | ||||||||||||||||||||||||
| 159 | ; | - | ||||||||||||||||||||||||
| 160 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | int | - | ||||||||||||||||||||||||
| 163 | progcomp_remove (cmd) | - | ||||||||||||||||||||||||
| 164 | char *cmd; | - | ||||||||||||||||||||||||
| 165 | { | - | ||||||||||||||||||||||||
| 166 | register BUCKET_CONTENTS *item; | - | ||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||
| 168 | if (prog_completes == 0
| 0 | ||||||||||||||||||||||||
| 169 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||
| 171 | item = hash_remove (cmd, prog_completes, 0); | - | ||||||||||||||||||||||||
| 172 | if (item
| 0 | ||||||||||||||||||||||||
| 173 | { | - | ||||||||||||||||||||||||
| 174 | if (item->data
| 0 | ||||||||||||||||||||||||
| 175 | free_progcomp (item->data); never executed: free_progcomp (item->data); | 0 | ||||||||||||||||||||||||
| 176 | sh_xfree((item->key), "pcomplib.c", 167); | - | ||||||||||||||||||||||||
| 177 | sh_xfree((item), "pcomplib.c", 168); | - | ||||||||||||||||||||||||
| 178 | return never executed: (1);return (1);never executed: return (1); | 0 | ||||||||||||||||||||||||
| 179 | } | - | ||||||||||||||||||||||||
| 180 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||||||||||||||
| 181 | } | - | ||||||||||||||||||||||||
| 182 | - | |||||||||||||||||||||||||
| 183 | int | - | ||||||||||||||||||||||||
| 184 | progcomp_insert (cmd, cs) | - | ||||||||||||||||||||||||
| 185 | char *cmd; | - | ||||||||||||||||||||||||
| 186 | COMPSPEC *cs; | - | ||||||||||||||||||||||||
| 187 | { | - | ||||||||||||||||||||||||
| 188 | register BUCKET_CONTENTS *item; | - | ||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | if (cs ==
| 0-601 | ||||||||||||||||||||||||
| 191 | ((void *)0)
| 0-601 | ||||||||||||||||||||||||
| 192 | ) | - | ||||||||||||||||||||||||
| 193 | programming_error ( never executed: programming_error ( dcgettext (((void *)0), "progcomp_insert: %s: NULL COMPSPEC" , 5) , cmd); | 0 | ||||||||||||||||||||||||
| 194 | dcgettext (((void *)0), never executed: programming_error ( dcgettext (((void *)0), "progcomp_insert: %s: NULL COMPSPEC" , 5) , cmd); | 0 | ||||||||||||||||||||||||
| 195 | "progcomp_insert: %s: NULL COMPSPEC" never executed: programming_error ( dcgettext (((void *)0), "progcomp_insert: %s: NULL COMPSPEC" , 5) , cmd); | 0 | ||||||||||||||||||||||||
| 196 | , 5) never executed: programming_error ( dcgettext (((void *)0), "progcomp_insert: %s: NULL COMPSPEC" , 5) , cmd); | 0 | ||||||||||||||||||||||||
| 197 | , cmd); never executed: programming_error ( dcgettext (((void *)0), "progcomp_insert: %s: NULL COMPSPEC" , 5) , cmd); | 0 | ||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||
| 199 | if (prog_completes == 0
| 2-599 | ||||||||||||||||||||||||
| 200 | progcomp_create (); executed 2 times by 1 test: progcomp_create ();Executed by:
| 2 | ||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||
| 202 | cs->refcount++; | - | ||||||||||||||||||||||||
| 203 | item = hash_insert (cmd, prog_completes, 0); | - | ||||||||||||||||||||||||
| 204 | if (item->data
| 2-599 | ||||||||||||||||||||||||
| 205 | free_progcomp (item->data); executed 2 times by 1 test: free_progcomp (item->data);Executed by:
| 2 | ||||||||||||||||||||||||
| 206 | else | - | ||||||||||||||||||||||||
| 207 | item->key = (char *)strcpy (sh_xmalloc((1 + strlen (cmd)), "pcomplib.c", 192), (cmd)); executed 599 times by 1 test: item->key = (char *)strcpy (sh_xmalloc((1 + strlen (cmd)), "pcomplib.c", 192), (cmd));Executed by:
| 599 | ||||||||||||||||||||||||
| 208 | item->data = cs; | - | ||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | return executed 601 times by 1 test: 1;return 1;Executed by:
executed 601 times by 1 test: return 1;Executed by:
| 601 | ||||||||||||||||||||||||
| 211 | } | - | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | COMPSPEC * | - | ||||||||||||||||||||||||
| 214 | progcomp_search (cmd) | - | ||||||||||||||||||||||||
| 215 | const char *cmd; | - | ||||||||||||||||||||||||
| 216 | { | - | ||||||||||||||||||||||||
| 217 | register BUCKET_CONTENTS *item; | - | ||||||||||||||||||||||||
| 218 | COMPSPEC *cs; | - | ||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | if (prog_completes == 0
| 0 | ||||||||||||||||||||||||
| 221 | return never executed: ((COMPSPEC *)return ((COMPSPEC *) ((void *)0) );never executed: return ((COMPSPEC *) ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 222 | ((void *)0) never executed: return ((COMPSPEC *) ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 223 | ); never executed: return ((COMPSPEC *) ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | item = hash_search (cmd, prog_completes, 0); | - | ||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | if (item ==
| 0 | ||||||||||||||||||||||||
| 228 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 229 | ) | - | ||||||||||||||||||||||||
| 230 | return never executed: ((COMPSPEC *)return ((COMPSPEC *) ((void *)0) );never executed: return ((COMPSPEC *) ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 231 | ((void *)0) never executed: return ((COMPSPEC *) ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 232 | ); never executed: return ((COMPSPEC *) ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||
| 234 | cs = (COMPSPEC *)item->data; | - | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | return never executed: (cs);return (cs);never executed: return (cs); | 0 | ||||||||||||||||||||||||
| 237 | } | - | ||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | void | - | ||||||||||||||||||||||||
| 240 | progcomp_walk (pfunc) | - | ||||||||||||||||||||||||
| 241 | hash_wfunc *pfunc; | - | ||||||||||||||||||||||||
| 242 | { | - | ||||||||||||||||||||||||
| 243 | if (prog_completes == 0
| 0 | ||||||||||||||||||||||||
| 244 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | hash_walk (prog_completes, pfunc); | - | ||||||||||||||||||||||||
| 247 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |