blob: 61a7f2f8537934c8f331f54aaf6ed51df949c6e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 );
}
}
|