[PATCH] remove hardcoded selection for HEX ESCAPES(???)

Robert P. J. Day rpjday at mindspring.com
Wed Mar 29 16:26:09 UTC 2006


  (if this patch is appropriate, feel free to apply it.  it removes
the hardcoded setting of the macro WANT_HEX_ESCAPES plus the
subsequent conditionals based on it.  it's not clear whether it makes
much sense to have that kind of conditional proprocessing if it's
not a menu configuration selection.  it's also not clear why you
*wouldn't* want hex escapes but if there's a good reason to keep
supporting that, then feel free to toss this patch.)

diff -pru busybox.orig/libbb/process_escape_sequence.c busybox/libbb/process_escape_sequence.c
--- busybox.orig/libbb/process_escape_sequence.c	2006-03-29 07:43:41.000000000 -0500
+++ busybox/libbb/process_escape_sequence.c	2006-03-29 11:21:03.000000000 -0500
@@ -27,8 +27,6 @@
 #include <ctype.h>
 #include "libbb.h"

-#define WANT_HEX_ESCAPES 1
-
 /* Usual "this only works for ascii compatible encodings" disclaimer. */
 #undef _tolower
 #define _tolower(X) ((X)|((char) 0x20))
@@ -51,29 +49,23 @@ char bb_process_escape_sequence(const ch
 	base = 8;
 	q = *ptr;

-#ifdef WANT_HEX_ESCAPES
 	if (*q == 'x') {
 		++q;
 		base = 16;
 		++num_digits;
 	}
-#endif

 	do {
 		d = (unsigned int)(*q - '0');
-#ifdef WANT_HEX_ESCAPES
 		if (d >= 10) {
 			d = ((unsigned int)(_tolower(*q) - 'a')) + 10;
 		}
-#endif

 		if (d >= base) {
-#ifdef WANT_HEX_ESCAPES
 			if ((base == 16) && (!--num_digits)) {
 /*				return '\\'; */
 				--q;
 			}
-#endif
 			break;
 		}


Signed off by:  Robert P. J. Day <rpjday at mindspring.com>



More information about the busybox mailing list