MCPcopy Index your code
hub / github.com/assaultcube/AC / conc

Function conc

source/src/command.cpp:429–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427}
428
429char *conc(const char **w, int n, bool space)
430{
431 if(n < 0)
432 { // auto-determine number of strings
433 n = 0;
434 while(w[n] && w[n][0]) n++;
435 }
436 static vector<int> wlen;
437 wlen.setsize(0);
438 int len = space ? max(n-1, 0) : 0;
439 loopj(n) len += wlen.add((int)strlen(w[j]));
440 if(len > CSLIMIT_STRINGLEN) { cslimiterr("string length"); return newstring(""); }
441 char *r = newstring("", len), *res = r;
442 loopi(n)
443 {
444 strncpy(r, w[i], wlen[i]); // make string-list out of all arguments
445 r += wlen[i];
446 if(space) *r++ = ' ';
447 }
448 if(space && n) --r;
449 *r = '\0';
450 return res;
451}
452
453VARN(numargs, _numargs, MAXWORDS, 0, 0);
454

Callers 6

getlistindexFunction · 0.85
writemapmodelattributesFunction · 0.85
listfavcatsFunction · 0.85
executeretFunction · 0.85
sortlistFunction · 0.85
listoptionsFunction · 0.85

Calls 6

maxFunction · 0.85
cslimiterrFunction · 0.85
newstringFunction · 0.85
setsizeMethod · 0.80
loopjFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected