Date: Thu, 14 Sep 2006 22:55:16 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 106123 for review Message-ID: <200609142255.k8EMtGwO090293@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=106123 Change 106123 by imp@imp_lighthouse on 2006/09/14 22:54:47 separate out the hard-core str* and mem* from the text parsing good. The latter moves to strcvt.c. This saves aboue 250 bytes in boot2, boot0spi and bootsd. Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#19 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/p_string.c#8 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/strcvt.c#1 add Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#19 (text+ko) ==== @@ -6,7 +6,7 @@ INTERNALLIB= SRCS=at91rm9200_lowlevel.c delay.c eeprom.c emac.c emac_init.c fpga.c getc.c \ p_string.c putchar.c printf.c reset.c spi_flash.c xmodem.c \ - sd-card.c mci_device.c + sd-card.c mci_device.c strcvt.c NO_MAN= .if ${MK_TAG_LIST} != "no" ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/p_string.c#8 (text+ko) ==== @@ -27,41 +27,6 @@ /* * .KB_C_FN_DEFINITION_START - * int p_IsWhiteSpace(char) - * This global function returns true if the character is not considered - * a non-space character. - * .KB_C_FN_DEFINITION_END - */ -int -p_IsWhiteSpace(char cValue) -{ - return ((cValue == ' ') || - (cValue == '\t') || - (cValue == 0) || - (cValue == '\r') || - (cValue == '\n')); -} - - -/* - * .KB_C_FN_DEFINITION_START - * unsigned p_HexCharValue(char) - * This global function returns the decimal value of the validated hex char. - * .KB_C_FN_DEFINITION_END - */ -unsigned -p_HexCharValue(char cValue) -{ - if (cValue < ('9' + 1)) - return (cValue - '0'); - if (cValue < ('F' + 1)) - return (cValue - 'A' + 10); - return (cValue - 'a' + 10); -} - - -/* - * .KB_C_FN_DEFINITION_START * void p_memset(char *buffer, char value, int size) * This global function sets memory at the pointer for the specified * number of bytes to value. @@ -109,54 +74,6 @@ return (to); } - -/* - * .KB_C_FN_DEFINITION_START - * unsigned p_ASCIIToHex(char *) - * This global function set the unsigned value equal to the converted - * hex number passed as a string. No error checking is performed; the - * string must be valid hex value, point at the start of string, and be - * NULL-terminated. - * .KB_C_FN_DEFINITION_END - */ -unsigned -p_ASCIIToHex(const char *buf) -{ - unsigned lValue = 0; - - if ((*buf == '0') && ((buf[1] == 'x') || (buf[1] == 'X'))) - buf += 2; - - while (*buf) { - lValue <<= 4; - lValue += p_HexCharValue(*buf++); - } - return (lValue); -} - - -/* - * .KB_C_FN_DEFINITION_START - * unsigned p_ASCIIToDec(char *) - * This global function set the unsigned value equal to the converted - * decimal number passed as a string. No error checking is performed; the - * string must be valid decimal value, point at the start of string, and be - * NULL-terminated. - * .KB_C_FN_DEFINITION_END - */ -unsigned -p_ASCIIToDec(const char *buf) -{ - unsigned v = 0; - - while (*buf) { - v *= 10; - v += (*buf++) - '0'; - } - return (v); -} - - /* * .KB_C_FN_DEFINITION_START * void p_memcpy(char *, char *, unsigned)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609142255.k8EMtGwO090293>