libc: move strncpy to core

Change-Id: If005a0305cedbab85905536238d0f799f19213e1
This commit is contained in:
Skye 2026-05-01 11:20:11 +09:00
parent 4c60fe95fc
commit 5951f6e5e9
14 changed files with 14 additions and 4 deletions

View file

@ -875,6 +875,7 @@ static const struct plugin_api rockbox_api = {
gui_synclist_scroll_stop,
add_event_ex,
remove_event_ex,
strncpy,
};
static int plugin_buffer_handle;

View file

@ -62,7 +62,6 @@
#define splash(__ticks, __str) splashf(__ticks, __str)
char* strncpy(char *, const char *, size_t);
void* plugin_get_buffer(size_t *buffer_size);
size_t plugin_reserve_buffer(size_t buffer_size);
int plugin_open(const char *plugin, const char *parameter);
@ -1038,6 +1037,7 @@ struct plugin_api {
void *event_data,
void *user_data),
void *user_data);
char* (*strncpy)(char * dst, const char * src, size_t count);
};
/* plugin header */

View file

@ -1119,7 +1119,7 @@ static void transcendFunc(char* func, double* tt, int* ttPower)
/* Save current function context */
char original_func[3];
strncpy(original_func, func, 3);
rb->strncpy(original_func, func, 3);
transcendFunc("asin", &arcsin_input, &arcsin_power);

View file

@ -76,6 +76,8 @@ int my_close(int id);
#define strcmp(a,b) rb->strcmp((a),(b))
#undef strncmp
#define strncmp(a,b,c) rb->strncmp((a),(b),(c))
#undef strncpy
#define strncpy(a,b,c) rb->strncpy((a),(b),(c))
#undef strchr
#define strchr(a,b) rb->strchr((a),(b))
#undef strrchr

View file

@ -15,7 +15,6 @@ highscore.c
simple_viewer.c
display_text.c
printcell_helper.c
strncpy.c
stdio_compat.c
#if (LCD_DEPTH < 4)

View file

@ -66,6 +66,7 @@ int splash_scroller(int timeout, const char* str);
#define strcmp rb->strcmp
#define strcpy rb->strcpy
#define strlen rb->strlen
#define strncpy rb->strncpy
#define strtol rb->strtol
#define strtoul rb->strtoul
#define strstr rb->strstr

View file

@ -29,6 +29,8 @@
#define strcat(a,b) rb->strcat(a,b)
#undef strncmp
#define strncmp(a,b,c) rb->strncmp(a,b,c)
#undef strncpy
#define strncpy(a,b,c) rb->strncpy(a,b,c)
#undef strcasecmp
#define strcasecmp(a,b) rb->strcasecmp(a,b)
#undef strstr

View file

@ -65,6 +65,7 @@ double acos_wrapper(double x);
#define strcmp rb->strcmp
#define strcpy rb->strcpy
#define strlen rb->strlen
#define strncpy rb->strncpy
#define strtol rb->strtol
#define strtoq strtoq_wrapper
#define strtouq strtouq_wrapper

View file

@ -169,6 +169,7 @@
#define strncat rb->strlcat /* hack */
#endif
#define strncmp rb->strncmp
#define strncpy rb->strncpy
#ifndef strncat
#define strpbrk strpbrk_wrapper
#endif

View file

@ -1,3 +1,4 @@
#include "duke3d.h"
#include "cvars.h"
#include "cvar_defs.h"
#include <stdlib.h>

View file

@ -325,7 +325,7 @@ void engine_saveGameState(struct Engine* e, uint8_t slot, const char *desc) {
file_writeUint16BE(&f, CUR_VER);
file_writeUint16BE(&f, 0);
char hdrdesc[32];
strncpy(hdrdesc, desc, sizeof(hdrdesc) - 1);
rb->strncpy(hdrdesc, desc, sizeof(hdrdesc) - 1);
file_write(&f, hdrdesc, sizeof(hdrdesc));
/* contents */
struct Serializer s;

View file

@ -356,6 +356,7 @@ libc/strcmp.c
libc/strcpy.c
libc/strcspn.c
libc/strncmp.c
libc/strncpy.c
libc/strrchr.c
libc/strstr.c
libc/mktime.c

View file

@ -34,6 +34,7 @@ char *_EXFUN(strerror,(int));
size_t _EXFUN(strlen,(const char *));
char *_EXFUN(strncat,(char *, const char *, size_t));
int _EXFUN(strncmp,(const char *, const char *, size_t));
char *_EXFUN(strncpy, (char *, const char *, size_t));
char *_EXFUN(strpbrk,(const char *, const char *));
char *_EXFUN(strrchr,(const char *, int));
size_t _EXFUN(strspn,(const char *, const char *));