Remove unused alternative const safe sortix string functions.
This commit is contained in:
parent
442aa49070
commit
50792cb986
6 changed files with 10 additions and 54 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2012, 2013, 2014 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2011, 2012, 2013, 2014, 2024 Jonas 'Sortie' Termansen.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -69,7 +69,6 @@
|
||||||
#endif
|
#endif
|
||||||
#if !defined(_SORTIX_SOURCE)
|
#if !defined(_SORTIX_SOURCE)
|
||||||
#define _SORTIX_SOURCE 1
|
#define _SORTIX_SOURCE 1
|
||||||
#define __IMPLICIT_SORTIX_SOURCE
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -90,7 +89,6 @@
|
||||||
/* Use the Sortix API if the default API was requested. */
|
/* Use the Sortix API if the default API was requested. */
|
||||||
#if defined(_DEFAULT_SOURCE) && !defined(_SORTIX_SOURCE)
|
#if defined(_DEFAULT_SOURCE) && !defined(_SORTIX_SOURCE)
|
||||||
#define _SORTIX_SOURCE 1
|
#define _SORTIX_SOURCE 1
|
||||||
#define __IMPLICIT_SORTIX_SOURCE
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Particular XSI revisions imply certain POSIX revisions. */
|
/* Particular XSI revisions imply certain POSIX revisions. */
|
||||||
|
@ -192,15 +190,6 @@
|
||||||
#define __USE_SORTIX 0
|
#define __USE_SORTIX 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Whether to override some "standard" functions with Sortix alternatives. */
|
|
||||||
#if !defined(__SORTIX_STDLIB_REDIRECTS)
|
|
||||||
#if __USE_SORTIX && !defined(__IMPLICIT_SORTIX_SOURCE)
|
|
||||||
#define __SORTIX_STDLIB_REDIRECTS 1
|
|
||||||
#else
|
|
||||||
#define __SORTIX_STDLIB_REDIRECTS 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Provide the restrict keyword when building system components. */
|
/* Provide the restrict keyword when building system components. */
|
||||||
#if defined(__is_sortix_system_component) && !defined(__want_restrict)
|
#if defined(__is_sortix_system_component) && !defined(__want_restrict)
|
||||||
#define __want_restrict 1
|
#define __want_restrict 1
|
||||||
|
|
|
@ -62,11 +62,7 @@ int strcmp(const char*, const char*);
|
||||||
int strcoll(const char*, const char*);
|
int strcoll(const char*, const char*);
|
||||||
char* strcpy(char* __restrict, const char* __restrict);
|
char* strcpy(char* __restrict, const char* __restrict);
|
||||||
size_t strcspn(const char*, const char*);
|
size_t strcspn(const char*, const char*);
|
||||||
#if __USE_SORTIX && __SORTIX_STDLIB_REDIRECTS
|
|
||||||
const char* strerror(int errnum) __asm__ ("sortix_strerror");
|
|
||||||
#else
|
|
||||||
char* strerror(int errnum);
|
char* strerror(int errnum);
|
||||||
#endif
|
|
||||||
size_t strlen(const char*);
|
size_t strlen(const char*);
|
||||||
char* strncat(char* __restrict, const char* __restrict, size_t);
|
char* strncat(char* __restrict, const char* __restrict, size_t);
|
||||||
int strncmp(const char*, const char*, size_t);
|
int strncmp(const char*, const char*, size_t);
|
||||||
|
@ -102,11 +98,7 @@ char* strdup(const char*);
|
||||||
/* Functions from POSIX 2001. */
|
/* Functions from POSIX 2001. */
|
||||||
#if __USE_SORTIX || 200112L <= __USE_POSIX
|
#if __USE_SORTIX || 200112L <= __USE_POSIX
|
||||||
int ffs(int);
|
int ffs(int);
|
||||||
#if __USE_SORTIX && __SORTIX_STDLIB_REDIRECTS
|
|
||||||
const char* strerror_l(int, locale_t) __asm__ ("sortix_strerror_l");
|
|
||||||
#else
|
|
||||||
char* strerror_l(int, locale_t);
|
char* strerror_l(int, locale_t);
|
||||||
#endif
|
|
||||||
int strerror_r(int, char*, size_t);
|
int strerror_r(int, char*, size_t);
|
||||||
char* strtok_r(char* __restrict, const char* __restrict, char** __restrict);
|
char* strtok_r(char* __restrict, const char* __restrict, char** __restrict);
|
||||||
#endif
|
#endif
|
||||||
|
@ -123,11 +115,7 @@ char* strndup_trace(struct __allocation_site*, const char*, size_t);
|
||||||
char* strndup(const char*, size_t);
|
char* strndup(const char*, size_t);
|
||||||
#endif
|
#endif
|
||||||
size_t strnlen(const char*, size_t);
|
size_t strnlen(const char*, size_t);
|
||||||
#if __USE_SORTIX && __SORTIX_STDLIB_REDIRECTS
|
|
||||||
const char* strsignal(int signum) __asm__ ("sortix_strsignal");
|
|
||||||
#else
|
|
||||||
char* strsignal(int signum);
|
char* strsignal(int signum);
|
||||||
#endif
|
|
||||||
size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t);
|
size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -150,9 +138,6 @@ int timingsafe_memcmp(const void*, const void*, size_t);
|
||||||
/* Functions that are Sortix extensions. */
|
/* Functions that are Sortix extensions. */
|
||||||
#if __USE_SORTIX
|
#if __USE_SORTIX
|
||||||
int ffsll(long long int);
|
int ffsll(long long int);
|
||||||
const char* sortix_strerror(int errnum);
|
|
||||||
const char* sortix_strerror_l(int, locale_t);
|
|
||||||
const char* sortix_strsignal(int signum);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __USE_SORTIX
|
#if __USE_SORTIX
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2016, 2020-2022 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2011-2016, 2020-2022, 2024 Jonas 'Sortie' Termansen.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -17,11 +17,10 @@
|
||||||
* Convert error code to a string.
|
* Convert error code to a string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __SORTIX_STDLIB_REDIRECTS 0
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
const char* sortix_strerror(int errnum)
|
char* strerror(int errnum)
|
||||||
{
|
{
|
||||||
switch ( errnum )
|
switch ( errnum )
|
||||||
{
|
{
|
||||||
|
@ -115,8 +114,3 @@ const char* sortix_strerror(int errnum)
|
||||||
default: return "Unknown error condition";
|
default: return "Unknown error condition";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* strerror(int errnum)
|
|
||||||
{
|
|
||||||
return (char*) sortix_strerror(errnum);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2013, 2024 Jonas 'Sortie' Termansen.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -17,16 +17,10 @@
|
||||||
* Convert error code to a string.
|
* Convert error code to a string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __SORTIX_STDLIB_REDIRECTS 0
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
const char* sortix_strerror_l(int errnum, locale_t locale)
|
|
||||||
{
|
|
||||||
(void) locale;
|
|
||||||
return sortix_strerror(errnum);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* strerror_l(int errnum, locale_t locale)
|
char* strerror_l(int errnum, locale_t locale)
|
||||||
{
|
{
|
||||||
return (char*) sortix_strerror_l(errnum, locale);
|
(void) locale;
|
||||||
|
return (char*) strerror(errnum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2012, 2013, 2014 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2011, 2012, 2013, 2014, 2024 Jonas 'Sortie' Termansen.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
int strerror_r(int errnum, char* dest, size_t dest_len)
|
int strerror_r(int errnum, char* dest, size_t dest_len)
|
||||||
{
|
{
|
||||||
const char* msg = sortix_strerror(errnum);
|
const char* msg = strerror(errnum);
|
||||||
if ( !msg )
|
if ( !msg )
|
||||||
return -1;
|
return -1;
|
||||||
if ( dest_len < strlen(msg) + 1 )
|
if ( dest_len < strlen(msg) + 1 )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2014 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2012, 2014, 2024 Jonas 'Sortie' Termansen.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -17,11 +17,10 @@
|
||||||
* Convert signal number to a string.
|
* Convert signal number to a string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __SORTIX_STDLIB_REDIRECTS 0
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
const char* sortix_strsignal(int signum)
|
char* strsignal(int signum)
|
||||||
{
|
{
|
||||||
switch ( signum )
|
switch ( signum )
|
||||||
{
|
{
|
||||||
|
@ -61,8 +60,3 @@ const char* sortix_strsignal(int signum)
|
||||||
|
|
||||||
return "Unknown signal value";
|
return "Unknown signal value";
|
||||||
}
|
}
|
||||||
|
|
||||||
char* strsignal(int signum)
|
|
||||||
{
|
|
||||||
return (char*) sortix_strsignal(signum);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue