MCPcopy Create free account
hub / github.com/NetHack/NetHack / nh_append

Function nh_append

outdated/sys/wince/mhtxtbuf.c:124–149  ·  view source on GitHub ↗

----------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

122}
123/*----------------------------------------------------------------*/
124static TCHAR *
125nh_append(TCHAR *s, int *size, const char *ap)
126{
127 int tlen, tnewlen;
128
129 if (!(ap && *ap))
130 return s;
131
132 /* append the calculated line to the text buffer */
133 tlen = s ? _tcslen(s) : 0;
134 tnewlen = tlen + strlen(ap);
135 if (tnewlen >= *size) {
136 *size = max(tnewlen, *size + BUFSZ);
137 s = (TCHAR *) realloc(s, *size * sizeof(TCHAR));
138 if (!s)
139 panic("Out of memory");
140 ZeroMemory(s + tlen, (*size - tlen) * sizeof(TCHAR));
141 }
142 if (strcmp(ap, "\r\n") == 0) {
143 _tcscat(s, TEXT("\r\n"));
144 } else {
145 NH_A2W(ap, s + tlen, strlen(ap));
146 s[tnewlen] = 0;
147 }
148 return s;
149}
150/*----------------------------------------------------------------*/
151void
152mswin_render_text(PNHTextBuffer pb, HWND edit_control)

Callers 1

mswin_render_textFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected