ReactOS 0.4.16-dev-88-ga65b6ae
Dynscat.c File Reference
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "Strn.h"
Include dependency graph for Dynscat.c:

Go to the source code of this file.

Functions

charDynscat (char **dst,...)
 

Function Documentation

◆ Dynscat()

char * Dynscat ( char **  dst,
  ... 
)

Definition at line 9 of file Dynscat.c.

10{
11 va_list ap;
12 const char *src;
13 char *newdst, *dcp;
14 size_t curLen, catLen, srcLen;
15
16 if (dst == (char **) 0)
17 return NULL;
18
19 catLen = 0;
20 va_start(ap, dst);
21 src = va_arg(ap, char *);
22 while (src != NULL) {
23 catLen += strlen(src);
24 src = va_arg(ap, char *);
25 }
26 va_end(ap);
27
28 if ((*dst == NULL) || (**dst == '\0'))
29 curLen = 0;
30 else
31 curLen = strlen(*dst);
32
33 if (*dst == NULL)
34 newdst = malloc(curLen + catLen + 2);
35 else
36 newdst = realloc(*dst, curLen + catLen + 2);
37 if (newdst == NULL)
38 return NULL;
39
40 dcp = newdst + curLen;
41 va_start(ap, dst);
42 src = va_arg(ap, char *);
43 while (src != NULL) {
44 srcLen = strlen(src);
45 memcpy(dcp, src, srcLen);
46 dcp += srcLen;
47 src = va_arg(ap, char *);
48 }
49 va_end(ap);
50 *dcp = '\0';
51
52 *dst = newdst;
53 return (newdst);
54} /* Dynscat */
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define va_arg(ap, T)
Definition: acmsvcex.h:89
#define realloc
Definition: debug_ros.c:6
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

Referenced by ComputeLNames(), ComputeRNames(), and main().