aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/other/strreq.c
blob: fb69b954e0e46fe4dfba643eca8f400b6ed9180a (plain)
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
38
39
/*
 * Memory pool string copy.
 * $Id$
 * Copyright (c) 1997 by Tycho Softworks.
 * For conditions of distribution and reuse see product license.
 */

#include <other/memory.h>

char	*strreq(MEMPOOL *mem, const char *str)
{
	char	*newstr;

	if(!str)
		return NULL;

	newstr = memreq(mem, strlen(str) + 1);
	if(!newstr)
		return NULL;

	strcpy(newstr, str);
	return newstr;
}

char	*strlreq(MEMPOOL *mem, const char *str)
{
	char	*newstr;

	if(!str)
		return NULL;

	newstr = memlreq(mem, strlen(str) + 1);
	if(!newstr)
		return NULL;

	strcpy(newstr, str);
	return newstr;
}