| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/xvasprintf.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | static char * | - | ||||||||||||
| 9 | xstrcat (size_t argcount, va_list args) | - | ||||||||||||
| 10 | { | - | ||||||||||||
| 11 | char *result; | - | ||||||||||||
| 12 | va_list ap; | - | ||||||||||||
| 13 | size_t totalsize; | - | ||||||||||||
| 14 | size_t i; | - | ||||||||||||
| 15 | char *p; | - | ||||||||||||
| 16 | - | |||||||||||||
| 17 | - | |||||||||||||
| 18 | totalsize = 0; | - | ||||||||||||
| 19 | - | |||||||||||||
| 20 | __builtin_va_copy( | - | ||||||||||||
| 21 | ap | - | ||||||||||||
| 22 | , | - | ||||||||||||
| 23 | args | - | ||||||||||||
| 24 | ) | - | ||||||||||||
| 25 | ; | - | ||||||||||||
| 26 | for (i = argcount; i > 0
| 216-432 | ||||||||||||
| 27 | { | - | ||||||||||||
| 28 | const char *next = | - | ||||||||||||
| 29 | __builtin_va_arg( | - | ||||||||||||
| 30 | ap | - | ||||||||||||
| 31 | , | - | ||||||||||||
| 32 | const char * | - | ||||||||||||
| 33 | ) | - | ||||||||||||
| 34 | ; | - | ||||||||||||
| 35 | totalsize = xsum (totalsize, strlen (next)); | - | ||||||||||||
| 36 | } executed 432 times by 1 test: end of blockExecuted by:
| 432 | ||||||||||||
| 37 | - | |||||||||||||
| 38 | __builtin_va_end( | - | ||||||||||||
| 39 | ap | - | ||||||||||||
| 40 | ) | - | ||||||||||||
| 41 | ; | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | - | |||||||||||||
| 46 | if (totalsize ==
| 0-216 | ||||||||||||
| 47 | (18446744073709551615UL)
| 0-216 | ||||||||||||
| 48 | || totalsize > 0x7fffffff
| 0-216 | ||||||||||||
| 49 | { | - | ||||||||||||
| 50 | - | |||||||||||||
| 51 | (*__errno_location ()) | - | ||||||||||||
| 52 | = | - | ||||||||||||
| 53 | 75 | - | ||||||||||||
| 54 | ; | - | ||||||||||||
| 55 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 56 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 57 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 58 | } | - | ||||||||||||
| 59 | - | |||||||||||||
| 60 | - | |||||||||||||
| 61 | result = ((char *) (sizeof (char) == 1 ? xmalloc (totalsize + 1) : xnmalloc (totalsize + 1, sizeof (char)))); | - | ||||||||||||
| 62 | p = result; | - | ||||||||||||
| 63 | for (i = argcount; i > 0
| 216-432 | ||||||||||||
| 64 | { | - | ||||||||||||
| 65 | const char *next = | - | ||||||||||||
| 66 | __builtin_va_arg( | - | ||||||||||||
| 67 | args | - | ||||||||||||
| 68 | , | - | ||||||||||||
| 69 | const char * | - | ||||||||||||
| 70 | ) | - | ||||||||||||
| 71 | ; | - | ||||||||||||
| 72 | size_t len = strlen (next); | - | ||||||||||||
| 73 | memcpy (p, next, len); | - | ||||||||||||
| 74 | p += len; | - | ||||||||||||
| 75 | } executed 432 times by 1 test: end of blockExecuted by:
| 432 | ||||||||||||
| 76 | *p = '\0'; | - | ||||||||||||
| 77 | - | |||||||||||||
| 78 | return executed 216 times by 1 test: result;return result;Executed by:
executed 216 times by 1 test: return result;Executed by:
| 216 | ||||||||||||
| 79 | } | - | ||||||||||||
| 80 | - | |||||||||||||
| 81 | char * | - | ||||||||||||
| 82 | xvasprintf (const char *format, va_list args) | - | ||||||||||||
| 83 | { | - | ||||||||||||
| 84 | char *result; | - | ||||||||||||
| 85 | - | |||||||||||||
| 86 | - | |||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | { | - | ||||||||||||
| 90 | size_t argcount = 0; | - | ||||||||||||
| 91 | const char *f; | - | ||||||||||||
| 92 | - | |||||||||||||
| 93 | for (f = format;;) | - | ||||||||||||
| 94 | { | - | ||||||||||||
| 95 | if (*
| 216-463 | ||||||||||||
| 96 | - | |||||||||||||
| 97 | return executed 216 times by 1 test: xstrcat (argcount, args);return xstrcat (argcount, args);Executed by:
executed 216 times by 1 test: return xstrcat (argcount, args);Executed by:
| 216 | ||||||||||||
| 98 | if (*
| 22-441 | ||||||||||||
| 99 | break; executed 22 times by 2 tests: break;Executed by:
| 22 | ||||||||||||
| 100 | f++; | - | ||||||||||||
| 101 | if (*
| 0-441 | ||||||||||||
| 102 | break; never executed: break; | 0 | ||||||||||||
| 103 | f++; | - | ||||||||||||
| 104 | argcount++; | - | ||||||||||||
| 105 | } executed 441 times by 2 tests: end of blockExecuted by:
| 441 | ||||||||||||
| 106 | } | - | ||||||||||||
| 107 | - | |||||||||||||
| 108 | if (vasprintf (&result, format, args) < 0
| 0-22 | ||||||||||||
| 109 | { | - | ||||||||||||
| 110 | if ( | - | ||||||||||||
| 111 | (*
| 0 | ||||||||||||
| 112 | ==
| 0 | ||||||||||||
| 113 | 12
| 0 | ||||||||||||
| 114 | ) | - | ||||||||||||
| 115 | xalloc_die (); never executed: xalloc_die (); | 0 | ||||||||||||
| 116 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 117 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 118 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 119 | } | - | ||||||||||||
| 120 | - | |||||||||||||
| 121 | return executed 22 times by 2 tests: result;return result;Executed by:
executed 22 times by 2 tests: return result;Executed by:
| 22 | ||||||||||||
| 122 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |