Skip to content

Commit 6fa95f2

Browse files
committed
grok_bin_oct_hex: Simplify flag
It's easier to understand and code if each flag name is for a single flag.
1 parent 080bee0 commit 6fa95f2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

numeric.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ Perl_grok_bin_oct_hex(pTHX_ const char *start,
400400
*flags = 0;
401401

402402
const bool allow_underscores =
403-
cBOOL(input_flags & PERL_SCAN_ALLOW_UNDERSCORES);
403+
cBOOL(input_flags & ( PERL_SCAN_ALLOW_UNDERSCORES
404+
|PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES));
404405
const char * s = start;
405406
const char * e = start + *len_p;
406407

@@ -555,8 +556,8 @@ Perl_grok_bin_oct_hex(pTHX_ const char *start,
555556
/* Don't allow a leading underscore if the only-medial bit is
556557
* set */
557558
&& ( LIKELY(s > s0)
558-
|| UNLIKELY((input_flags & PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES)
559-
!= PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES)))
559+
|| UNLIKELY(! ( input_flags
560+
& PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES))))
560561
{
561562
++s;
562563

perl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8345,7 +8345,8 @@ EXTERN_C int flock(int fd, int op);
83458345
# define PERL_SCAN_SILENT_OVERFLOW 0x80
83468346

83478347
/* Forbid a leading underscore, which the other one doesn't */
8348-
# define PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES (0x100|PERL_SCAN_ALLOW_UNDERSCORES)
8348+
# define PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES 0x100
8349+
83498350
#endif
83508351

83518352

0 commit comments

Comments
 (0)