Modernize code base

This commit is contained in:
topjohnwu
2018-11-07 02:10:38 -05:00
parent ca35a9681f
commit 7c12bf7fa1
21 changed files with 421 additions and 287 deletions

View File

@@ -268,3 +268,11 @@ int exec_command(int err, int *fd, void (*cb)(void), const char *argv0, ...) {
va_end(argv);
return pid;
}
char *strdup2(const char *s, size_t *size) {
size_t l = strlen(s) + 1;
char *buf = new char[l];
memcpy(buf, s, l);
if (size) *size = l;
return buf;
}