diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2003-05-15 12:46:15 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2003-05-15 12:46:15 +0800 |
commit | 53979f2fd3bb35dcfa700905ccdea30f47a7c905 (patch) | |
tree | 469bf5254d185ab04a53a0d619e78ce4f16b6a27 | |
parent | 54d7371b4212218aa4ec7b3bb534afa1e9a0a469 (diff) | |
download | marcuscom-ports-53979f2fd3bb35dcfa700905ccdea30f47a7c905.tar marcuscom-ports-53979f2fd3bb35dcfa700905ccdea30f47a7c905.tar.gz marcuscom-ports-53979f2fd3bb35dcfa700905ccdea30f47a7c905.tar.bz2 marcuscom-ports-53979f2fd3bb35dcfa700905ccdea30f47a7c905.tar.lz marcuscom-ports-53979f2fd3bb35dcfa700905ccdea30f47a7c905.tar.xz marcuscom-ports-53979f2fd3bb35dcfa700905ccdea30f47a7c905.tar.zst marcuscom-ports-53979f2fd3bb35dcfa700905ccdea30f47a7c905.zip |
Add an inline implementation of strndup.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@757 df743ca5-7f9a-e211-a948-0013205c9059
-rw-r--r-- | x11/libxklavier/files/patch-libxlavier_xklavier_config.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/x11/libxklavier/files/patch-libxlavier_xklavier_config.c b/x11/libxklavier/files/patch-libxlavier_xklavier_config.c new file mode 100644 index 000000000..61a7f2f85 --- /dev/null +++ b/x11/libxklavier/files/patch-libxlavier_xklavier_config.c @@ -0,0 +1,37 @@ +--- libxklavier/xklavier_config.c.orig Thu May 15 00:43:07 2003 ++++ libxklavier/xklavier_config.c Thu May 15 00:45:12 2003 +@@ -42,6 +42,18 @@ + static XkbComponentNamesRec componentNames; + static char *locale; + ++static char * ++xxx_strndup(const char *str, int len) { ++ char *ret; ++ ++ if ((str == NULL || len < 0)) return(NULL); ++ ret = (char *)malloc(len + 1); ++ if (ret == NULL) return(NULL); ++ memcpy(ret, str, len); ++ ret[len] = '\0'; ++ return(ret); ++} ++ + static Bool _XklConfigInitialized( ) + { + return theRegistry.xpathContext != NULL; +@@ -306,13 +318,13 @@ + while( ( npc = strchr( pc, ',' ) ) != NULL ) + { + int len = npc - pc; +- *ppc = ( char * ) strndup( pc, len ); ++ *ppc = ( char * ) xxx_strndup( pc, len ); + ppc++; + pc = npc + 1; + } + + len = npc - pc; +- *ppc = ( char * ) strndup( pc, len ); ++ *ppc = ( char * ) xxx_strndup( pc, len ); + } + } + |