MCPcopy Create free account
hub / github.com/F-Stack/f-stack / allocstr

Function allocstr

tools/libutil/login_cap.c:66–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64static char path_login_conf[] = _PATH_LOGIN_CONF;
65
66static char *
67allocstr(const char *str)
68{
69 char *p;
70
71 size_t sz = strlen(str) + 1; /* realloc() only if necessary */
72 if (sz <= internal_stringsz)
73 p = strcpy(internal_string, str);
74 else if ((p = realloc(internal_string, sz)) != NULL) {
75 internal_stringsz = sz;
76 internal_string = strcpy(p, str);
77 }
78 return p;
79}
80
81
82static const char **

Callers 1

arrayizeFunction · 0.85

Calls 1

reallocFunction · 0.50

Tested by

no test coverage detected