mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2025-02-25 18:55:23 -06:00
Inline the ctype functions, so as to reduce size.
This commit is contained in:
parent
cd68333f86
commit
c6ff7b1486
@ -38,7 +38,6 @@ SYS_OBJS = system/cpuid.o \
|
|||||||
system/xhci.o
|
system/xhci.o
|
||||||
|
|
||||||
LIB_OBJS = lib/barrier.o \
|
LIB_OBJS = lib/barrier.o \
|
||||||
lib/ctype.o \
|
|
||||||
lib/div64.o \
|
lib/div64.o \
|
||||||
lib/print.o \
|
lib/print.o \
|
||||||
lib/read.o \
|
lib/read.o \
|
||||||
|
@ -38,7 +38,6 @@ SYS_OBJS = system/cpuid.o \
|
|||||||
system/xhci.o
|
system/xhci.o
|
||||||
|
|
||||||
LIB_OBJS = lib/barrier.o \
|
LIB_OBJS = lib/barrier.o \
|
||||||
lib/ctype.o \
|
|
||||||
lib/print.o \
|
lib/print.o \
|
||||||
lib/read.o \
|
lib/read.o \
|
||||||
lib/string.o \
|
lib/string.o \
|
||||||
|
27
lib/ctype.c
27
lib/ctype.c
@ -1,27 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
|
||||||
// Copyright (C) 2020 Martin Whitaker.
|
|
||||||
|
|
||||||
#include "ctype.h"
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Public Functions
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int toupper(int c)
|
|
||||||
{
|
|
||||||
if (c >= 'a' && c <= 'z') {
|
|
||||||
return c + 'A' -'a';
|
|
||||||
} else {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int isdigit(int c)
|
|
||||||
{
|
|
||||||
return c >= '0' && c <= '9';
|
|
||||||
}
|
|
||||||
|
|
||||||
int isxdigit(int c)
|
|
||||||
{
|
|
||||||
return isdigit(c) || (toupper(c) >= 'A' && toupper(c) <= 'F');
|
|
||||||
}
|
|
19
lib/ctype.h
19
lib/ctype.h
@ -14,18 +14,31 @@
|
|||||||
* If c is a lower-case letter, returns its upper-case equivalent, otherwise
|
* If c is a lower-case letter, returns its upper-case equivalent, otherwise
|
||||||
* returns c. Assumes c is an ASCII character.
|
* returns c. Assumes c is an ASCII character.
|
||||||
*/
|
*/
|
||||||
int toupper(int c);
|
static inline int toupper(int c)
|
||||||
|
{
|
||||||
|
if (c >= 'a' && c <= 'z') {
|
||||||
|
return c + 'A' -'a';
|
||||||
|
} else {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns 1 if c is a decimal digit, otherwise returns 0. Assumes c is an
|
* Returns 1 if c is a decimal digit, otherwise returns 0. Assumes c is an
|
||||||
* ASCII character.
|
* ASCII character.
|
||||||
*/
|
*/
|
||||||
int isdigit(int c);
|
static inline int isdigit(int c)
|
||||||
|
{
|
||||||
|
return c >= '0' && c <= '9';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns 1 if c is a hexadecimal digit, otherwise returns 0. Assumes c is an
|
* Returns 1 if c is a hexadecimal digit, otherwise returns 0. Assumes c is an
|
||||||
* ASCII character.
|
* ASCII character.
|
||||||
*/
|
*/
|
||||||
int isxdigit(int c);
|
static inline int isxdigit(int c)
|
||||||
|
{
|
||||||
|
return isdigit(c) || (toupper(c) >= 'A' && toupper(c) <= 'F');
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CTYPE_H
|
#endif // CTYPE_H
|
||||||
|
Loading…
Reference in New Issue
Block a user