Safe copy: copies maxlen-1 max and for maxlen>0 returns zero terminated dest.
| 283 | |
| 284 | // Safe copy: copies maxlen-1 max and for maxlen>0 returns zero terminated dest. |
| 285 | void strncpyz(char *dest, const char *src, size_t maxlen) |
| 286 | { |
| 287 | if (maxlen>0) |
| 288 | { |
| 289 | while (--maxlen>0 && *src!=0) |
| 290 | *dest++=*src++; |
| 291 | *dest=0; |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | |
| 296 | // Safe copy: copies maxlen-1 max and for maxlen>0 returns zero terminated dest. |
no outgoing calls
no test coverage detected