Branch Coverage

toml.c
Criterion Covered Total %
branch 421 900 46.7


line true false branch
45 0 0 if (xxmalloc) ppmalloc = xxmalloc;
46 0 0 if (xxfree) ppfree = xxfree;
57 40 0 if (p) {
68 0 0 if (p) {
79 68 0 if (p) {
101 0 0 if (0 == (i >> 7)) {
102 0 0 if (len < 1) return -1;
109 0 0 if (0x6 == (i >> 5)) {
110 0 0 if (len < 2) return -1;
112 0 0 for (int j = 0; j < 1; j++) {
114 0 0 if (0x2 != (i >> 6)) return -1;
123 0 0 if (0xE == (i >> 4)) {
124 0 0 if (len < 3) return -1;
126 0 0 for (int j = 0; j < 2; j++) {
128 0 0 if (0x2 != (i >> 6)) return -1;
137 0 0 if (0x1E == (i >> 3)) {
138 0 0 if (len < 4) return -1;
140 0 0 for (int j = 0; j < 3; j++) {
142 0 0 if (0x2 != (i >> 6)) return -1;
151 0 0 if (0x3E == (i >> 2)) {
152 0 0 if (len < 5) return -1;
154 0 0 for (int j = 0; j < 4; j++) {
156 0 0 if (0x2 != (i >> 6)) return -1;
165 0 0 if (0x7e == (i >> 1)) {
166 0 0 if (len < 6) return -1;
168 0 0 for (int j = 0; j < 5; j++) {
170 0 0 if (0x2 != (i >> 6)) return -1;
191 0 0 if (0xd800 <= code && code <= 0xdfff) return -1;
0 0 if (0xd800 <= code && code <= 0xdfff) return -1;
192 0 0 if (0xfffe <= code && code <= 0xffff) return -1;
0 0 if (0xfffe <= code && code <= 0xffff) return -1;
197 0 0 if (code < 0) return -1;
198 0 0 if (code <= 0x7F) {
206 0 0 if (code <= 0x000007FF) {
215 0 0 if (code <= 0x0000FFFF) {
225 0 0 if (code <= 0x001FFFFF) {
236 0 0 if (code <= 0x03FFFFFF) {
248 0 0 if (code <= 0x7FFFFFFF) {
309 133 41 static inline void xfree(const void* x) { if (x) FREE((void*)(intptr_t)x); }
404 0 34 if (!s) return 0;
414 0 30 if (!s) return 0;
425 0 17 if (!pp) return 0;
445 0 0 if (off >= max - 10) { /* have some slack for misc stuff */
448 0 0 if (!x) {
458 0 0 if (sp >= sq) break;
462 0 0 if ((0 <= ch && ch <= 0x08)
0 0 if ((0 <= ch && ch <= 0x08)
463 0 0 || (0x0a <= ch && ch <= 0x1f)
0 0 || (0x0a <= ch && ch <= 0x1f)
464 0 0 || (ch == 0x7f)) {
465 0 0 if (! (multiline && (ch == '\r' || ch == '\n'))) {
0 0 if (! (multiline && (ch == '\r' || ch == '\n'))) {
0 0 if (! (multiline && (ch == '\r' || ch == '\n'))) {
500 17 134 if (off >= max - 10) { /* have some slack for misc stuff */
503 0 17 if (!x) {
513 17 134 if (sp >= sq) break;
516 134 0 if (ch != '\\') {
518 120 14 if ((0 <= ch && ch <= 0x08)
120 0 if ((0 <= ch && ch <= 0x08)
519 120 14 || (0x0a <= ch && ch <= 0x1f)
120 0 || (0x0a <= ch && ch <= 0x1f)
520 0 134 || (ch == 0x7f)) {
521 0 0 if (! (multiline && (ch == '\r' || ch == '\n'))) {
0 0 if (! (multiline && (ch == '\r' || ch == '\n'))) {
0 0 if (! (multiline && (ch == '\r' || ch == '\n'))) {
534 0 0 if (sp >= sq) {
541 0 0 if (multiline) {
544 0 0 if (sp[strspn(sp, " \t\r")] == '\n') {
557 0 0 int nhex = (ch == 'u' ? 4 : 8);
558 0 0 for (int i = 0; i < nhex; i++) {
559 0 0 if (sp >= sq) {
565 0 0 int v = ('0' <= ch && ch <= '9')
567 0 0 : (('A' <= ch && ch <= 'F') ? ch - 'A' + 10 : -1);
0 0 : (('A' <= ch && ch <= 'F') ? ch - 'A' + 10 : -1);
0 0 : (('A' <= ch && ch <= 'F') ? ch - 'A' + 10 : -1);
568 0 0 if (-1 == v) {
576 0 0 if (-1 == n) {
618 39 0 if (ch == '\'' || ch == '\"') {
1 38 if (ch == '\'' || ch == '\"') {
621 0 1 if (sp[1] == ch && sp[2] == ch) {
0 0 if (sp[1] == ch && sp[2] == ch) {
628 0 1 if (ch == '\'') {
630 0 0 if (! (ret = STRNDUP(sp, sq - sp))) {
637 0 1 if (!ret) {
644 0 1 if (strchr(ret, '\n')) {
654 218 38 for (xp = sp; xp != sq; xp++) {
656 217 1 if (isalnum(k)) continue;
657 0 1 if (k == '_' || k == '-') continue;
0 0 if (k == '_' || k == '-') continue;
663 0 38 if (! (ret = STRNDUP(sp, sq - sp))) {
683 22 10 if (!ret_tab) ret_tab = (toml_table_t**) &dummy;
684 30 2 if (!ret_arr) ret_arr = (toml_array_t**) &dummy;
685 30 2 if (!ret_val) ret_val = (toml_keyval_t**) &dummy;
689 24 32 for (i = 0; i < tab->nkval; i++) {
690 0 24 if (0 == strcmp(key, tab->kval[i]->key)) {
695 7 32 for (i = 0; i < tab->narr; i++) {
696 0 7 if (0 == strcmp(key, tab->arr[i]->key)) {
701 13 30 for (i = 0; i < tab->ntab; i++) {
702 2 11 if (0 == strcmp(key, tab->tab[i]->key)) {
724 0 17 if (!newkey) return 0;
728 0 17 if (key_kind(tab, newkey)) {
737 0 17 if (0 == (base = (toml_keyval_t**) expand_ptrarr((void**)tab->kval, n))) {
744 0 17 if (0 == (base[n] = (toml_keyval_t*) CALLOC(1, sizeof(*base[n])))) {
765 0 8 if (!newkey) return 0;
769 0 8 if (check_key(tab, newkey, 0, 0, &dest)) {
773 0 0 if (dest && dest->implicit) {
0 0 if (dest && dest->implicit) {
785 0 8 if (0 == (base = (toml_table_t**) expand_ptrarr((void**)tab->tab, n))) {
792 0 8 if (0 == (base[n] = (toml_table_t*) CALLOC(1, sizeof(*base[n])))) {
816 0 5 if (!newkey) return 0;
819 0 5 if (key_kind(tab, newkey)) {
828 0 5 if (0 == (base = (toml_array_t**) expand_ptrarr((void**)tab->arr, n))) {
835 0 5 if (0 == (base[n] = (toml_array_t*) CALLOC(1, sizeof(*base[n])))) {
854 0 13 if (!base) {
870 0 2 if (!base) {
875 0 2 if (!ret) {
892 0 2 if (!base) {
897 0 2 if (!ret) {
910 0 34 while (ctx->tok.tok == NEWLINE) {
911 0 0 if (next_token(ctx, isdotspecial)) return -1;
912 0 0 if (ctx->tok.eof) break;
922 0 103 if (ctx->tok.tok != typ)
925 0 103 if (next_token(ctx, isdotspecial))
938 0 3 if (eat_token(ctx, LBRACE, 1, FLINE))
942 0 4 if (ctx->tok.tok == NEWLINE)
946 1 3 if (ctx->tok.tok == RBRACE)
949 0 3 if (ctx->tok.tok != STRING)
952 0 3 if (parse_keyval(ctx, tab))
955 0 3 if (ctx->tok.tok == NEWLINE)
959 1 2 if (ctx->tok.tok == COMMA) {
960 0 1 if (eat_token(ctx, COMMA, 1, FLINE))
967 0 3 if (eat_token(ctx, RBRACE, 1, FLINE))
978 13 0 if (*val == '\'' || *val == '"') return 's';
3 10 if (*val == '\'' || *val == '"') return 's';
979 2 8 if (0 == toml_rtob(val, 0)) return 'b';
980 4 4 if (0 == toml_rtoi(val, 0)) return 'i';
981 2 2 if (0 == toml_rtod(val, 0)) return 'd';
982 1 1 if (0 == toml_rtots(val, &ts)) {
983 1 0 if (ts.year && ts.hour) return 'T'; /* timestamp */
1 0 if (ts.year && ts.hour) return 'T'; /* timestamp */
984 0 0 if (ts.year) return 'D'; /* date */
994 0 7 if (eat_token(ctx, LBRACKET, 0, FLINE)) return -1;
997 0 17 if (skip_newlines(ctx, 0)) return -1;
1000 0 17 if (ctx->tok.tok == RBRACKET) break;
1006 5 8 if (arr->kind == 0)
1008 0 8 else if (arr->kind != 'v')
1016 0 13 if (!newval)
1019 0 13 if (! (newval->val = STRNDUP(val, vlen)))
1025 5 8 if (arr->nitem == 1)
1027 5 3 else if (arr->type != newval->valtype)
1030 0 13 if (eat_token(ctx, STRING, 0, FLINE)) return -1;
1037 1 1 if (arr->kind == 0)
1039 0 1 else if (arr->kind != 'a')
1043 0 2 if (!subarr) return -1;
1044 0 2 if (parse_array(ctx, subarr)) return -1;
1051 1 1 if (arr->kind == 0)
1053 1 0 else if (arr->kind != 't')
1057 0 2 if (!subtab) return -1;
1058 0 2 if (parse_inline_table(ctx, subtab)) return -1;
1066 0 17 if (skip_newlines(ctx, 0)) return -1;
1069 10 7 if (ctx->tok.tok == COMMA) {
1070 0 10 if (eat_token(ctx, COMMA, 0, FLINE)) return -1;
1076 0 7 if (eat_token(ctx, RBRACKET, 1, FLINE)) return -1;
1088 0 25 if (tab->readonly) {
1093 0 25 if (eat_token(ctx, STRING, 1, FLINE)) return -1;
1095 0 25 if (ctx->tok.tok == DOT) {
1104 0 0 if (!subtabstr) return -1;
1109 0 0 if (!subtab) {
1111 0 0 if (!subtab) return -1;
1113 0 0 if (next_token(ctx, 1)) return -1;
1114 0 0 if (parse_keyval(ctx, subtab)) return -1;
1118 1 24 if (ctx->tok.tok != EQUAL) {
1122 1 23 if (next_token(ctx, 0)) return -1;
1128 0 17 if (!keyval) return -1;
1131 0 17 assert(keyval->val == 0);
1132 0 17 if (! (keyval->val = STRNDUP(val.ptr, val.len)))
1135 0 17 if (next_token(ctx, 1)) return -1;
1143 0 5 if (!arr) return -1;
1144 0 5 if (parse_array(ctx, arr)) return -1;
1151 0 1 if (!nxttab) return -1;
1152 0 1 if (parse_inline_table(ctx, nxttab)) return -1;
1179 2 7 for (i = 0; i < ctx->tpath.top; i++) {
1187 0 9 if (ctx->tpath.top >= 10)
1190 0 9 if (ctx->tok.tok != STRING)
1194 0 9 if (!key) return -1;
1199 0 9 if (next_token(ctx, 1)) return -1;
1201 7 2 if (ctx->tok.tok == RBRACKET) break;
1203 0 2 if (ctx->tok.tok != DOT)
1206 0 2 if (next_token(ctx, 1)) return -1;
1209 0 7 if (ctx->tpath.top <= 0)
1224 2 7 for (int i = 0; i < ctx->tpath.top; i++) {
1237 0 0 if (nextarr->kind != 't')
1240 0 0 if (nextarr->nitem == 0)
1253 0 0 if (0 == base)
1258 0 0 if (0 == (base[n] = (toml_table_t*) CALLOC(1, sizeof(*base[n]))))
1261 0 0 if (0 == (base[n]->key = STRDUP(key)))
1286 0 7 assert(ctx->tok.tok == LBRACKET);
1289 7 0 int llb = (ctx->tok.ptr + 1 < ctx->stop && ctx->tok.ptr[1] == '[');
0 7 int llb = (ctx->tok.ptr + 1 < ctx->stop && ctx->tok.ptr[1] == '[');
1294 0 7 if (eat_token(ctx, LBRACKET, 1, FLINE)) return -1;
1295 0 7 if (llb) {
1296 0 0 assert(ctx->tok.tok == LBRACKET);
1297 0 0 if (eat_token(ctx, LBRACKET, 1, FLINE)) return -1;
1300 0 7 if (fill_tabpath(ctx)) return -1;
1309 0 7 if (walk_tabpath(ctx)) return -1;
1311 7 0 if (! llb) {
1314 0 7 if (!curtab) return -1;
1321 0 0 if (!zstr) return -1;
1325 0 0 if (!arr) {
1327 0 0 if (!arr) return -1;
1329 0 0 if (arr->kind != 't')
1336 0 0 if (!t) return -1;
1338 0 0 if (0 == (t->key = STRDUP("__anon__")))
1347 0 7 if (ctx->tok.tok != RBRACKET) {
1350 0 7 if (llb) {
1351 0 0 if (! (ctx->tok.ptr + 1 < ctx->stop && ctx->tok.ptr[1] == ']')) {
0 0 if (! (ctx->tok.ptr + 1 < ctx->stop && ctx->tok.ptr[1] == ']')) {
1354 0 0 if (eat_token(ctx, RBRACKET, 1, FLINE)) return -1;
1357 0 7 if (eat_token(ctx, RBRACKET, 1, FLINE))
1360 0 7 if (ctx->tok.tok != NEWLINE)
1376 0 6 if (errbufsz <= 0) errbufsz = 0;
1377 6 0 if (errbufsz > 0) errbuf[0] = 0;
1393 0 6 if (0 == (ctx.root = CALLOC(1, sizeof(*ctx.root)))) {
1403 54 4 for (token_t tok = ctx.tok; ! tok.eof ; tok = ctx.tok) {
1407 0 25 if (next_token(&ctx, 1)) goto fail;
1411 2 20 if (parse_keyval(&ctx, ctx.curtab)) goto fail;
1413 0 20 if (ctx.tok.tok != NEWLINE) {
1418 0 20 if (eat_token(&ctx, NEWLINE, 1, FLINE)) goto fail;
1422 0 7 if (parse_select(&ctx)) goto fail;
1432 0 4 for (int i = 0; i < ctx.tpath.top; i++) xfree(ctx.tpath.key[i]);
1437 0 2 for (int i = 0; i < ctx.tpath.top; i++) xfree(ctx.tpath.key[i]);
1452 0 0 while (! feof(fp)) {
1454 0 0 if (off == bufsz) {
1457 0 0 if (!x) {
1468 0 0 if (ferror(fp)) {
1469 0 0 snprintf(errbuf, errbufsz, "%s",
1478 0 0 if (off == bufsz) {
1481 0 0 if (!x) {
1500 0 17 if (!p) return;
1510 0 7 if (!p) return;
1514 17 7 for (int i = 0; i < n; i++) {
1516 13 4 if (a->val)
1518 2 2 else if (a->arr)
1520 2 0 else if (a->tab)
1532 0 16 if (!p) return;
1536 17 16 for (i = 0; i < p->nkval; i++) xfree_kval(p->kval[i]);
1539 5 16 for (i = 0; i < p->narr; i++) xfree_arr(p->arr[i]);
1542 8 16 for (i = 0; i < p->ntab; i++) xfree_tab(p->tab[i]);
1577 344 100 for ( ; n > 0 && isdigit(*p); n--, p++) {
262 82 for ( ; n > 0 && isdigit(*p); n--, p++) {
1580 100 82 return n ? -1 : ret;
1587 23 44 month = (year >= 0 && p[4] == '-') ? scan_digits(p+5, 2) : -1;
15 8 month = (year >= 0 && p[4] == '-') ? scan_digits(p+5, 2) : -1;
1588 15 52 day = (month >= 0 && p[7] == '-') ? scan_digits(p+8, 2) : -1;
15 0 day = (month >= 0 && p[7] == '-') ? scan_digits(p+8, 2) : -1;
1589 14 53 if (YY) *YY = year;
1590 14 53 if (MM) *MM = month;
1591 14 53 if (DD) *DD = day;
1592 23 44 return (year >= 0 && month >= 0 && day >= 0) ? 0 : -1;
15 8 return (year >= 0 && month >= 0 && day >= 0) ? 0 : -1;
15 0 return (year >= 0 && month >= 0 && day >= 0) ? 0 : -1;
1599 25 38 minute = (hour >= 0 && p[2] == ':') ? scan_digits(p+3, 2) : -1;
11 14 minute = (hour >= 0 && p[2] == ':') ? scan_digits(p+3, 2) : -1;
1600 11 52 second = (minute >= 0 && p[5] == ':') ? scan_digits(p+6, 2) : -1;
11 0 second = (minute >= 0 && p[5] == ':') ? scan_digits(p+6, 2) : -1;
1601 14 49 if (hh) *hh = hour;
1602 14 49 if (mm) *mm = minute;
1603 14 49 if (ss) *ss = second;
1604 25 38 return (hour >= 0 && minute >= 0 && second >= 0) ? 0 : -1;
11 14 return (hour >= 0 && minute >= 0 && second >= 0) ? 0 : -1;
11 0 return (hour >= 0 && minute >= 0 && second >= 0) ? 0 : -1;
1611 0 65 if (0 == strncmp(p, "'''", 3)) {
1616 0 0 if (0 == q) {
1619 0 0 while (q[3] == '\'') q++;
1627 0 65 if (0 == strncmp(p, "\"\"\"", 3)) {
1632 0 0 if (0 == q) {
1635 0 0 if (q[-1] == '\\') {
1639 0 0 while (q[3] == '\"') q++;
1647 0 0 for (p += 3; p < q; p++) {
1648 0 0 if (escape) {
1650 0 0 if (strchr("btnfr\"\\", *p)) continue;
1651 0 0 if (*p == 'u') { hexreq = 4; continue; }
1652 0 0 if (*p == 'U') { hexreq = 8; continue; }
1653 0 0 if (p[strspn(p, " \t\r")] == '\n') continue; /* allow for line ending backslash */
1656 0 0 if (hexreq) {
1658 0 0 if (strchr("0123456789ABCDEF", *p)) continue;
1661 0 0 if (*p == '\\') { escape = 1; continue; }
1663 0 0 if (escape)
1665 0 0 if (hexreq)
1672 0 65 if ('\'' == *p) {
1673 0 0 for (p++; *p && *p != '\n' && *p != '\''; p++);
0 0 for (p++; *p && *p != '\n' && *p != '\''; p++);
0 0 for (p++; *p && *p != '\n' && *p != '\''; p++);
1674 0 0 if (*p != '\'') {
1682 12 53 if ('\"' == *p) {
1686 134 0 for (p++; *p; p++) {
1687 0 134 if (escape) {
1689 0 0 if (strchr("btnfr\"\\", *p)) continue;
1690 0 0 if (*p == 'u') { hexreq = 4; continue; }
1691 0 0 if (*p == 'U') { hexreq = 8; continue; }
1694 0 134 if (hexreq) {
1696 0 0 if (strchr("0123456789ABCDEF", *p)) continue;
1699 2 132 if (sqcnt) {
1700 2 0 if (*p == '\'') {
1701 1 1 if (++sqcnt < 3) continue;
1707 0 132 if (*p == '\\') { escape = 1; continue; }
1708 1 131 if (*p == '\'') { sqcnt = 1; continue; }
1709 0 131 if (*p == '\n') break;
1710 11 120 if (*p == '"') break;
1712 0 11 if (*p != '"') {
1721 49 4 if (0 == scan_date(p, 0, 0, 0) || 0 == scan_time(p, 0, 0, 0)) {
0 49 if (0 == scan_date(p, 0, 0, 0) || 0 == scan_time(p, 0, 0, 0)) {
1723 104 4 for ( ; strchr("0123456789.:+-T Z", toupper(*p)); p++);
1725 0 4 for ( ; p[-1] == ' '; p--);
1732 303 1 for ( ; *p && *p != '\n'; p++) {
298 5 for ( ; *p && *p != '\n'; p++) {
1734 7 291 if (ch == '.' && dotisspecial) break;
2 5 if (ch == '.' && dotisspecial) break;
1735 216 80 if ('A' <= ch && ch <= 'Z') continue;
0 216 if ('A' <= ch && ch <= 'Z') continue;
1736 206 90 if ('a' <= ch && ch <= 'z') continue;
206 0 if ('a' <= ch && ch <= 'z') continue;
1737 49 41 if (strchr("0123456789+-_.", ch)) continue;
1753 581 180 for (i = 0; i < ctx->tok.len; i++) {
1754 39 542 if (*p++ == '\n')
1759 249 5 while (p < ctx->stop) {
1761 3 246 if (*p == '#') {
1762 75 0 for (p++; p < ctx->stop && *p != '\n'; p++);
72 3 for (p++; p < ctx->stop && *p != '\n'; p++);
1766 153 93 if (dotisspecial && *p == '.') {
2 151 if (dotisspecial && *p == '.') {
1795 22 30 if (keyidx < tab->nkval) return tab->kval[keyidx]->key;
1798 6 24 if (keyidx < tab->narr) return tab->arr[keyidx]->key;
1801 8 16 if (keyidx < tab->ntab) return tab->tab[keyidx]->key;
1809 207 0 for (i = 0; i < tab->nkval; i++) {
1810 76 131 if (0 == strcmp(key, tab->kval[i]->key))
1819 41 35 for (i = 0; i < tab->narr; i++) {
1820 21 20 if (0 == strcmp(key, tab->arr[i]->key))
1830 104 42 for (i = 0; i < tab->ntab; i++) {
1831 29 75 if (0 == strcmp(key, tab->tab[i]->key))
1839 105 0 return (0 <= idx && idx < arr->nitem) ? arr->item[idx].val : 0;
105 0 return (0 <= idx && idx < arr->nitem) ? arr->item[idx].val : 0;
1849 0 0 if (arr->kind != 'v')
1852 0 0 if (arr->nitem == 0)
1866 0 0 return arr ? arr->key : (const char*) NULL;
1886 0 0 return tab ? tab->key : (const char*) NULL;
1891 43 0 return (0 <= idx && idx < arr->nitem) ? arr->item[idx].arr : 0;
43 0 return (0 <= idx && idx < arr->nitem) ? arr->item[idx].arr : 0;
1896 43 0 return (0 <= idx && idx < arr->nitem) ? arr->item[idx].tab : 0;
43 0 return (0 <= idx && idx < arr->nitem) ? arr->item[idx].tab : 0;
1902 0 14 if (! src_) return -1;
1918 11 3 if (0 == scan_date(p, year, month, day)) {
1924 11 0 if (*p) {
1926 0 11 if (*p != 'T' && *p != ' ') return -1;
0 0 if (*p != 'T' && *p != ' ') return -1;
1933 11 3 if (0 == scan_time(p, hour, minute, second)) {
1940 1 10 if (*p == '.') {
1945 0 1 if (errno) {
1948 0 1 while (*millisec > 999) {
1956 11 0 if (*p) {
1960 11 0 if (*p == 'Z' || *p == 'z') {
0 11 if (*p == 'Z' || *p == 'z') {
1964 11 0 } else if (*p == '+' || *p == '-') {
11 0 } else if (*p == '+' || *p == '-') {
1967 11 0 if (! (isdigit(p[0]) && isdigit(p[1]))) return -1;
0 11 if (! (isdigit(p[0]) && isdigit(p[1]))) return -1;
1971 11 0 if (*p == ':') {
1974 11 0 if (! (isdigit(p[0]) && isdigit(p[1]))) return -1;
0 11 if (! (isdigit(p[0]) && isdigit(p[1]))) return -1;
1983 3 11 if (*p != 0)
1986 11 0 if (must_parse_time && !ret->hour)
0 11 if (must_parse_time && !ret->hour)
1996 0 58 if (!src) return -1;
1998 10 48 int* ret = ret_ ? ret_ : &dummy;
2000 7 51 if (0 == strcmp(src, "true")) {
2004 9 42 if (0 == strcmp(src, "false")) {
2015 0 42 if (!src) return -1;
2023 8 34 int64_t* ret = ret_ ? ret_ : &dummy;
2027 42 0 if (s[0] == '+' || s[0] == '-')
0 42 if (s[0] == '+' || s[0] == '-')
2031 0 42 if (s[0] == '_')
2035 3 39 if ('0' == s[0]) {
2043 3 0 if (s[1]) return -1;
2048 382 39 while (*s && p < q) {
382 0 while (*s && p < q) {
2050 0 382 switch (ch) {
2053 0 0 if (s[0] == '_') return -1;
2060 39 0 if (*s || p == q) return -1;
0 39 if (*s || p == q) return -1;
2063 0 39 if (s[-1] == '_') return -1;
2072 39 0 return (errno || *endp) ? -1 : 0;
24 15 return (errno || *endp) ? -1 : 0;
2078 0 27 if (!src) return -1;
2084 4 23 double* ret = ret_ ? ret_ : &dummy;
2088 27 0 if (s[0] == '+' || s[0] == '-')
0 27 if (s[0] == '+' || s[0] == '-')
2092 0 27 if (s[0] == '_')
2098 14 13 if (dot) {
2099 14 0 if (dot == s || !isdigit(dot[-1]) || !isdigit(dot[1]))
14 0 if (dot == s || !isdigit(dot[-1]) || !isdigit(dot[1]))
0 14 if (dot == s || !isdigit(dot[-1]) || !isdigit(dot[1]))
2105 3 24 if (s[0] == '0' && s[1] && !strchr("eE.", s[1]))
3 0 if (s[0] == '0' && s[1] && !strchr("eE.", s[1]))
3 0 if (s[0] == '0' && s[1] && !strchr("eE.", s[1]))
2109 331 24 while (*s && p < q) {
331 0 while (*s && p < q) {
2111 0 331 if (ch == '_') {
2113 0 0 if (s[0] == '_') return -1;
2115 0 0 if (s[0] == 0) return -1;
2120 24 0 if (*s || p == q) return -1; /* reached end of string or buffer is full? */
0 24 if (*s || p == q) return -1; /* reached end of string or buffer is full? */
2129 24 0 return (errno || *endp) ? -1 : 0;
11 13 return (errno || *endp) ? -1 : 0;
2148 0 64 if (!src) return -1;
2152 64 0 if (! (qchar == '\'' || qchar == '"')) {
48 16 if (! (qchar == '\'' || qchar == '"')) {
2157 0 16 if (qchar == src[1] && qchar == src[2]) {
0 0 if (qchar == src[1] && qchar == src[2]) {
2162 0 0 if (! (sp <= sq && sq[0] == qchar && sq[1] == qchar && sq[2] == qchar))
0 0 if (! (sp <= sq && sq[0] == qchar && sq[1] == qchar && sq[2] == qchar))
0 0 if (! (sp <= sq && sq[0] == qchar && sq[1] == qchar && sq[2] == qchar))
0 0 if (! (sp <= sq && sq[0] == qchar && sq[1] == qchar && sq[2] == qchar))
2166 0 0 if (sp[0] == '\n')
2168 0 0 else if (sp[0] == '\r' && sp[1] == '\n')
0 0 else if (sp[0] == '\r' && sp[1] == '\n')
2175 16 0 if (! (sp <= sq && *sq == qchar))
0 16 if (! (sp <= sq && *sq == qchar))
2179 0 16 if (qchar == '\'') {
2189 16 0 return *ret ? 0 : -1;
2231 5 1 if (ret.ok) {
2233 5 0 if (ret.ok) {
2235 5 0 if (ret.u.ts->year) ret.u.ts->year = &ret.u.ts->__buffer.year;
2236 5 0 if (ret.u.ts->month) ret.u.ts->month = &ret.u.ts->__buffer.month;
2237 5 0 if (ret.u.ts->day) ret.u.ts->day = &ret.u.ts->__buffer.day;
2238 5 0 if (ret.u.ts->hour) ret.u.ts->hour = &ret.u.ts->__buffer.hour;
2239 5 0 if (ret.u.ts->minute) ret.u.ts->minute = &ret.u.ts->__buffer.minute;
2240 5 0 if (ret.u.ts->second) ret.u.ts->second = &ret.u.ts->__buffer.second;
2241 0 5 if (ret.u.ts->millisec) ret.u.ts->millisec = &ret.u.ts->__buffer.millisec;
2242 5 0 if (ret.u.ts->z) ret.u.ts->z = ret.u.ts->__buffer.z;
2253 27 0 if (raw) {
2289 5 1 if (ret.ok) {
2291 5 0 if (ret.ok) {
2293 5 0 if (ret.u.ts->year) ret.u.ts->year = &ret.u.ts->__buffer.year;
2294 5 0 if (ret.u.ts->month) ret.u.ts->month = &ret.u.ts->__buffer.month;
2295 5 0 if (ret.u.ts->day) ret.u.ts->day = &ret.u.ts->__buffer.day;
2296 5 0 if (ret.u.ts->hour) ret.u.ts->hour = &ret.u.ts->__buffer.hour;
2297 5 0 if (ret.u.ts->minute) ret.u.ts->minute = &ret.u.ts->__buffer.minute;
2298 5 0 if (ret.u.ts->second) ret.u.ts->second = &ret.u.ts->__buffer.second;
2299 1 4 if (ret.u.ts->millisec) ret.u.ts->millisec = &ret.u.ts->__buffer.millisec;
2300 5 0 if (ret.u.ts->z) ret.u.ts->z = ret.u.ts->__buffer.z;