Skip to content

Commit c429a9a

Browse files
committed
Avoid name collisions between sources
1 parent b2b496e commit c429a9a

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

libbf.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,7 +2829,7 @@ int bf_mul_pow_radix(bf_t *r, const bf_t *T, limb_t radix,
28292829
return ret;
28302830
}
28312831

2832-
static inline int to_digit(int c)
2832+
static inline int bf_to_digit(int c)
28332833
{
28342834
if (c >= '0' && c <= '9')
28352835
return c - '0';
@@ -2936,7 +2936,7 @@ static int bf_atof_internal(bf_t *r, slimb_t *pexponent,
29362936
goto no_prefix;
29372937
}
29382938
/* there must be a digit after the prefix */
2939-
if (to_digit((uint8_t)*p) >= radix) {
2939+
if (bf_to_digit((uint8_t)*p) >= radix) {
29402940
bf_set_nan(r);
29412941
ret = 0;
29422942
goto done;
@@ -2984,14 +2984,14 @@ static int bf_atof_internal(bf_t *r, slimb_t *pexponent,
29842984
int_len = digit_count = 0;
29852985
for(;;) {
29862986
limb_t c;
2987-
if (*p == '.' && (p > p_start || to_digit(p[1]) < radix)) {
2987+
if (*p == '.' && (p > p_start || bf_to_digit(p[1]) < radix)) {
29882988
if (has_decpt)
29892989
break;
29902990
has_decpt = TRUE;
29912991
int_len = digit_count;
29922992
p++;
29932993
}
2994-
c = to_digit(*p);
2994+
c = bf_to_digit(*p);
29952995
if (c >= radix)
29962996
break;
29972997
digit_count++;
@@ -3072,7 +3072,7 @@ static int bf_atof_internal(bf_t *r, slimb_t *pexponent,
30723072
}
30733073
for(;;) {
30743074
int c;
3075-
c = to_digit(*p);
3075+
c = bf_to_digit(*p);
30763076
if (c >= 10)
30773077
break;
30783078
if (unlikely(expn > ((BF_RAW_EXP_MAX - 2 - 9) / 10))) {

libregexp.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static const REOpCode reopcode_info[REOP_COUNT] = {
109109

110110
#define RE_HEADER_LEN 8
111111

112-
static inline int is_digit(int c) {
112+
static inline int lre_is_digit(int c) {
113113
return c >= '0' && c <= '9';
114114
}
115115

@@ -577,7 +577,7 @@ int lre_parse_escape(const uint8_t **pp, int allow_utf16)
577577
c -= '0';
578578
if (allow_utf16 == 2) {
579579
/* only accept \0 not followed by digit */
580-
if (c != 0 || is_digit(*p))
580+
if (c != 0 || lre_is_digit(*p))
581581
return -1;
582582
} else {
583583
/* parse a legacy octal sequence */
@@ -1285,7 +1285,7 @@ static int re_parse_term(REParseState *s, BOOL is_backward_dir)
12851285
case '{':
12861286
if (s->is_unicode) {
12871287
return re_parse_error(s, "syntax error");
1288-
} else if (!is_digit(p[1])) {
1288+
} else if (!lre_is_digit(p[1])) {
12891289
/* Annex B: we accept '{' not followed by digits as a
12901290
normal atom */
12911291
goto parse_class_atom;
@@ -1295,7 +1295,7 @@ static int re_parse_term(REParseState *s, BOOL is_backward_dir)
12951295
parse_digits(&p1, TRUE);
12961296
if (*p1 == ',') {
12971297
p1++;
1298-
if (is_digit(*p1)) {
1298+
if (lre_is_digit(*p1)) {
12991299
parse_digits(&p1, TRUE);
13001300
}
13011301
}
@@ -1443,7 +1443,7 @@ static int re_parse_term(REParseState *s, BOOL is_backward_dir)
14431443
p += 2;
14441444
c = 0;
14451445
if (s->is_unicode) {
1446-
if (is_digit(*p)) {
1446+
if (lre_is_digit(*p)) {
14471447
return re_parse_error(s, "invalid decimal escape in regular expression");
14481448
}
14491449
} else {
@@ -1565,7 +1565,7 @@ static int re_parse_term(REParseState *s, BOOL is_backward_dir)
15651565
const uint8_t *p1 = p;
15661566
/* As an extension (see ES6 annex B), we accept '{' not
15671567
followed by digits as a normal atom */
1568-
if (!is_digit(p[1])) {
1568+
if (!lre_is_digit(p[1])) {
15691569
if (s->is_unicode)
15701570
goto invalid_quant_count;
15711571
break;
@@ -1575,7 +1575,7 @@ static int re_parse_term(REParseState *s, BOOL is_backward_dir)
15751575
quant_max = quant_min;
15761576
if (*p == ',') {
15771577
p++;
1578-
if (is_digit(*p)) {
1578+
if (lre_is_digit(*p)) {
15791579
quant_max = parse_digits(&p, TRUE);
15801580
if (quant_max < quant_min) {
15811581
invalid_quant_count:
@@ -1812,7 +1812,7 @@ static int re_parse_disjunction(REParseState *s, BOOL is_backward_dir)
18121812
}
18131813

18141814
/* the control flow is recursive so the analysis can be linear */
1815-
static int compute_stack_size(const uint8_t *bc_buf, int bc_buf_len)
1815+
static int lre_compute_stack_size(const uint8_t *bc_buf, int bc_buf_len)
18161816
{
18171817
int stack_size, stack_size_max, pos, opcode, len;
18181818
uint32_t val;
@@ -1925,7 +1925,7 @@ uint8_t *lre_compile(int *plen, char *error_msg, int error_msg_size,
19251925
goto error;
19261926
}
19271927

1928-
stack_size = compute_stack_size(s->byte_code.buf, s->byte_code.size);
1928+
stack_size = lre_compute_stack_size(s->byte_code.buf, s->byte_code.size);
19291929
if (stack_size < 0) {
19301930
re_parse_error(s, "too many imbricated quantifiers");
19311931
goto error;

quickjs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47746,7 +47746,7 @@ static int64_t math_mod(int64_t a, int64_t b) {
4774647746
return m + (m < 0) * b;
4774747747
}
4774847748

47749-
static int64_t floor_div(int64_t a, int64_t b) {
47749+
static int64_t floor_div_int64(int64_t a, int64_t b) {
4775047750
/* integer division rounding toward -Infinity */
4775147751
int64_t m = a % b;
4775247752
return (a - (m + (m < 0) * b)) / b;
@@ -47780,8 +47780,8 @@ static JSValue JS_SetThisTimeValue(JSContext *ctx, JSValue this_val, double v)
4778047780
}
4778147781

4778247782
static int64_t days_from_year(int64_t y) {
47783-
return 365 * (y - 1970) + floor_div(y - 1969, 4) -
47784-
floor_div(y - 1901, 100) + floor_div(y - 1601, 400);
47783+
return 365 * (y - 1970) + floor_div_int64(y - 1969, 4) -
47784+
floor_div_int64(y - 1901, 100) + floor_div_int64(y - 1601, 400);
4778547785
}
4778647786

4778747787
static int64_t days_in_year(int64_t y) {
@@ -47791,7 +47791,7 @@ static int64_t days_in_year(int64_t y) {
4779147791
/* return the year, update days */
4779247792
static int64_t year_from_days(int64_t *days) {
4779347793
int64_t y, d1, nd, d = *days;
47794-
y = floor_div(d * 10000, 3652425) + 1970;
47794+
y = floor_div_int64(d * 10000, 3652425) + 1970;
4779547795
/* the initial approximation is very good, so only a few
4779647796
iterations are necessary */
4779747797
for(;;) {

0 commit comments

Comments
 (0)