Created a common xstrdup function.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@973 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
65b28a80a4
commit
72055744b9
1
proto.h
1
proto.h
@ -77,6 +77,7 @@ BOOL pstcache_init(uint8 cache_id);
|
||||
int main(int argc, char *argv[]);
|
||||
void generate_random(uint8 * random);
|
||||
void *xmalloc(int size);
|
||||
char *xstrdup(const char *s);
|
||||
void *xrealloc(void *oldmem, int size);
|
||||
void xfree(void *mem);
|
||||
void error(char *format, ...);
|
||||
|
20
rdesktop.c
20
rdesktop.c
@ -382,12 +382,7 @@ main(int argc, char *argv[])
|
||||
locale = setlocale(LC_ALL, "");
|
||||
if (locale)
|
||||
{
|
||||
locale = strdup(locale);
|
||||
if (locale == NULL)
|
||||
{
|
||||
perror("strdup");
|
||||
exit(1);
|
||||
}
|
||||
locale = xstrdup(locale);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -941,6 +936,19 @@ xmalloc(int size)
|
||||
return mem;
|
||||
}
|
||||
|
||||
/* strdup */
|
||||
char *
|
||||
xstrdup(const char *s)
|
||||
{
|
||||
char *mem = strdup(s);
|
||||
if (mem == NULL)
|
||||
{
|
||||
perror("strdup");
|
||||
exit(1);
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
|
||||
/* realloc; exit if out of memory */
|
||||
void *
|
||||
xrealloc(void *oldmem, int size)
|
||||
|
@ -50,7 +50,7 @@ wave_out_open(void)
|
||||
|
||||
if (dsp_dev == NULL)
|
||||
{
|
||||
dsp_dev = strdup("/dev/dsp");
|
||||
dsp_dev = xstrdup("/dev/dsp");
|
||||
}
|
||||
|
||||
if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1)
|
||||
|
@ -54,7 +54,7 @@ wave_out_open(void)
|
||||
|
||||
if (dsp_dev == NULL)
|
||||
{
|
||||
dsp_dev = strdup("/dev/audio");
|
||||
dsp_dev = xstrdup("/dev/audio");
|
||||
}
|
||||
|
||||
if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1)
|
||||
|
Loading…
Reference in New Issue
Block a user