mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-16 16:41:35 +02:00
Lose intermediate handling (unused). Change argument parsing to work properly over multiple buffers by saving a copy of the argument (we can't just save off/len since the buffer may vanish at any point).
This commit is contained in:
14
xmalloc.c
14
xmalloc.c
@ -1,4 +1,4 @@
|
||||
/* $Id: xmalloc.c,v 1.2 2007-07-25 23:13:18 nicm Exp $ */
|
||||
/* $Id: xmalloc.c,v 1.3 2007-09-29 14:25:49 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -69,6 +69,18 @@ ensure_size(void *buf, size_t *len, size_t nmemb, size_t size)
|
||||
return (buf);
|
||||
}
|
||||
|
||||
char *
|
||||
xmemstrdup(const char *buf, size_t len)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = xmalloc(len + 1);
|
||||
memcpy(s, buf, len);
|
||||
s[len] = '\0';
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
char *
|
||||
xstrdup(const char *s)
|
||||
{
|
||||
|
Reference in New Issue
Block a user