OpenCoverage

xvasprintf.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/xvasprintf.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8static char *-
9xstrcat (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
i > 0Description
TRUEevaluated 432 times by 1 test
Evaluated by:
  • stat
FALSEevaluated 216 times by 1 test
Evaluated by:
  • stat
; i--)
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 block
Executed by:
  • stat
432
37 -
38 __builtin_va_end(-
39 ap-
40 )-
41 ;-
42-
43-
44-
45-
46 if (totalsize ==
totalsize == (...73709551615UL)Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • stat
0-216
47 (18446744073709551615UL)
totalsize == (...73709551615UL)Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • stat
0-216
48 || totalsize > 0x7fffffff
totalsize > 0x7fffffffDescription
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • stat
)
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
i > 0Description
TRUEevaluated 432 times by 1 test
Evaluated by:
  • stat
FALSEevaluated 216 times by 1 test
Evaluated by:
  • stat
; i--)
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 block
Executed by:
  • stat
432
76 *p = '\0';-
77-
78 return
executed 216 times by 1 test: return result;
Executed by:
  • stat
result;
executed 216 times by 1 test: return result;
Executed by:
  • stat
216
79}-
80-
81char *-
82xvasprintf (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 (*
*f == '\0'Description
TRUEevaluated 216 times by 1 test
Evaluated by:
  • stat
FALSEevaluated 463 times by 3 tests
Evaluated by:
  • dd
  • stat
  • test
f == '\0'
*f == '\0'Description
TRUEevaluated 216 times by 1 test
Evaluated by:
  • stat
FALSEevaluated 463 times by 3 tests
Evaluated by:
  • dd
  • stat
  • test
)
216-463
96-
97 return
executed 216 times by 1 test: return xstrcat (argcount, args);
Executed by:
  • stat
xstrcat (argcount, args);
executed 216 times by 1 test: return xstrcat (argcount, args);
Executed by:
  • stat
216
98 if (*
*f != '%'Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • dd
  • test
FALSEevaluated 441 times by 2 tests
Evaluated by:
  • dd
  • stat
f != '%'
*f != '%'Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • dd
  • test
FALSEevaluated 441 times by 2 tests
Evaluated by:
  • dd
  • stat
)
22-441
99 break;
executed 22 times by 2 tests: break;
Executed by:
  • dd
  • test
22
100 f++;-
101 if (*
*f != 's'Description
TRUEnever evaluated
FALSEevaluated 441 times by 2 tests
Evaluated by:
  • dd
  • stat
f != 's'
*f != 's'Description
TRUEnever evaluated
FALSEevaluated 441 times by 2 tests
Evaluated by:
  • dd
  • stat
)
0-441
102 break;
never executed: break;
0
103 f++;-
104 argcount++;-
105 }
executed 441 times by 2 tests: end of block
Executed by:
  • dd
  • stat
441
106 }-
107-
108 if (vasprintf (&result, format, args) < 0
vasprintf (&re...mat, args) < 0Description
TRUEnever evaluated
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • dd
  • test
)
0-22
109 {-
110 if (-
111 (*
(*__errno_location ()) == 12Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 12Description
TRUEnever evaluated
FALSEnever evaluated
0
112 ==
(*__errno_location ()) == 12Description
TRUEnever evaluated
FALSEnever evaluated
0
113 12
(*__errno_location ()) == 12Description
TRUEnever evaluated
FALSEnever evaluated
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: return result;
Executed by:
  • dd
  • test
result;
executed 22 times by 2 tests: return result;
Executed by:
  • dd
  • test
22
122}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2