aboutsummaryrefslogtreecommitdiff
path: root/src/include/lib/stringinfo.h
blob: 74a6929883a44eb94b7da4b8aa278e83bef29d40 (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
40
41
42
43
44
45
46
47
/*-------------------------------------------------------------------------
 *
 * stringinfo.h--
 *	  Declarations/definitons for "string" functions.
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 * $Id: stringinfo.h,v 1.5 1997/09/08 21:52:22 momjian Exp $
 *
 *-------------------------------------------------------------------------
 */
#ifndef STRINGINFO_H
#define STRINGINFO_H


/*-------------------------
 * StringInfoData holds information about a string.
 *		'data' is the string.
 *		'len' is the current string length (as returned by 'strlen')
 *		'maxlen' is the size in bytes of 'data', i.e. the maximum string
 *				size (includeing the terminating '\0' char) that we can
 *				currently store in 'data' without having to reallocate
 *				more space.
 */
typedef struct StringInfoData
{
	char	   *data;
	int			maxlen;
	int			len;
} StringInfoData;

typedef StringInfoData *StringInfo;

/*------------------------
 * makeStringInfo
 * create a 'StringInfoData' & return a pointer to it.
 */
extern StringInfo makeStringInfo(void);

/*------------------------
 * appendStringInfo
 * similar to 'strcat' but reallocates more space if necessary...
 */
extern void appendStringInfo(StringInfo str, char *buffer);

#endif							/* STRINGINFO_H */