mirror of
https://github.com/tailix/libkernaux.git
synced 2025-04-14 17:32:55 -04:00
Add libc func "isspace"
This commit is contained in:
parent
5c02a62f35
commit
63f0dc880f
5 changed files with 14 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
2022-01-23 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* include/kernaux/assert.h: Require semicolon after macros
|
||||
* include/kernaux/libc.h: Add func "isdigit"
|
||||
* include/kernaux/libc.h: Add funcs "isdigit", "isspace"
|
||||
|
||||
2022-01-22 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ stable options.
|
|||
in freestanding environment, where no libc is present. You can also separately
|
||||
include or exclude components:
|
||||
* `--with[out]-libc-isdigit`
|
||||
* `--with[out]-libc-isspace`
|
||||
* `--with[out]-libc-memset`
|
||||
* `--with[out]-libc-strcpy`
|
||||
* `--with[out]-libc-strlen`
|
||||
|
|
|
@ -36,6 +36,7 @@ AC_ARG_WITH( [units], AS_HELP_STRING([--without-units], [without m
|
|||
dnl Packages (disabled by default)
|
||||
AC_ARG_WITH( [libc], AS_HELP_STRING([--with-libc], [with libc replacement]))
|
||||
AC_ARG_WITH( [libc-isdigit], AS_HELP_STRING([--with-libc-isdigit], [with isdigit replacement]))
|
||||
AC_ARG_WITH( [libc-isspace], AS_HELP_STRING([--with-libc-isspace], [with isspace replacement]))
|
||||
AC_ARG_WITH( [libc-memset], AS_HELP_STRING([--with-libc-memset], [with memset replacement]))
|
||||
AC_ARG_WITH( [libc-strcpy], AS_HELP_STRING([--with-libc-strcpy], [with strcpy replacement]))
|
||||
AC_ARG_WITH( [libc-strlen], AS_HELP_STRING([--with-libc-strlen], [with strlen replacement]))
|
||||
|
@ -61,6 +62,7 @@ AS_IF([test "$with_all" = no], do_without_all)
|
|||
AC_DEFUN([do_with_libc],
|
||||
[
|
||||
if test -z "$with_libc_isdigit"; then with_libc_isdigit=yes; fi
|
||||
if test -z "$with_libc_isspace"; then with_libc_isspace=yes; fi
|
||||
if test -z "$with_libc_memset"; then with_libc_memset=yes; fi
|
||||
if test -z "$with_libc_strcpy"; then with_libc_strcpy=yes; fi
|
||||
if test -z "$with_libc_strlen"; then with_libc_strlen=yes; fi
|
||||
|
@ -103,6 +105,7 @@ AM_CONDITIONAL([WITH_UNITS], [test "$with_units" != no])
|
|||
|
||||
dnl Packages (disabled by default)
|
||||
AM_CONDITIONAL([WITH_LIBC_ISDIGIT], [test "$with_libc_isdigit" = yes])
|
||||
AM_CONDITIONAL([WITH_LIBC_ISSPACE], [test "$with_libc_isspace" = yes])
|
||||
AM_CONDITIONAL([WITH_LIBC_MEMSET], [test "$with_libc_memset" = yes])
|
||||
AM_CONDITIONAL([WITH_LIBC_STRCPY], [test "$with_libc_strcpy" = yes])
|
||||
AM_CONDITIONAL([WITH_LIBC_STRLEN], [test "$with_libc_strlen" = yes])
|
||||
|
@ -136,6 +139,7 @@ AS_IF([test "$with_units", != no], [AC_DEFINE([WITH_UNITS], [1]
|
|||
|
||||
dnl Packages (disabled by default)
|
||||
AS_IF([test "$with_libc_isdigit" = yes], [AC_DEFINE([WITH_LIBC_ISDIGIT], [1], [with isdigit replacement])])
|
||||
AS_IF([test "$with_libc_isspace" = yes], [AC_DEFINE([WITH_LIBC_ISSPACE], [1], [with isspace replacement])])
|
||||
AS_IF([test "$with_libc_memset" = yes], [AC_DEFINE([WITH_LIBC_MEMSET], [1], [with memset replacement])])
|
||||
AS_IF([test "$with_libc_strcpy" = yes], [AC_DEFINE([WITH_LIBC_STRCPY], [1], [with strcpy replacement])])
|
||||
AS_IF([test "$with_libc_strlen" = yes], [AC_DEFINE([WITH_LIBC_STRLEN], [1], [with strlen replacement])])
|
||||
|
|
|
@ -9,6 +9,7 @@ extern "C" {
|
|||
|
||||
// <ctype.h>
|
||||
int isdigit(int c);
|
||||
int isspace(int c);
|
||||
|
||||
// <string.h>
|
||||
void *memset(void *s, int c, size_t n);
|
||||
|
|
|
@ -11,6 +11,13 @@ int isdigit(const int c)
|
|||
}
|
||||
#endif // WITH_LIBC_ISDIGIT
|
||||
|
||||
#ifdef WITH_LIBC_ISSPACE
|
||||
int isspace(const int c)
|
||||
{
|
||||
return c == ' ' || (unsigned)c - '\t' < 5;
|
||||
}
|
||||
#endif // WITH_LIBC_ISSPACE
|
||||
|
||||
#ifdef WITH_LIBC_MEMSET
|
||||
void *memset(void *s, int c, size_t n)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue