| 427 | } |
| 428 | |
| 429 | char *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 | |
| 453 | VARN(numargs, _numargs, MAXWORDS, 0, 0); |
| 454 |
no test coverage detected