From: Dale Weiler Date: Wed, 14 Aug 2013 06:19:48 +0000 (+0000) Subject: Remove vec_upload X-Git-Tag: v0.3.0~25 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1201f06a55585b927f340687095160c473642d25;p=xonotic%2Fgmqcc.git Remove vec_upload --- diff --git a/code.c b/code.c index 42b46a4..5c62efb 100644 --- a/code.c +++ b/code.c @@ -115,7 +115,7 @@ uint32_t code_genstring(code_t *code, const char *str) { return CODE_HASH_LEAVE(existing); CODE_HASH_LEAVE(existing) = vec_size(code->chars); - vec_upload(code->chars, str, strlen(str)+1); + vec_append(code->chars, strlen(str)+1, str); util_htseth(code->string_cache, str, hash, CODE_HASH_ENTER(existing)); return CODE_HASH_LEAVE(existing); diff --git a/ftepp.c b/ftepp.c index 3f45bc2..613b5c7 100644 --- a/ftepp.c +++ b/ftepp.c @@ -1340,10 +1340,10 @@ static bool ftepp_directive_warning(ftepp_t *ftepp) { /* handle the odd non string constant case so it works like C */ if (ftepp->token != TOKEN_STRINGCONST) { bool store = false; - vec_upload(message, "#warning", 8); + vec_append(message, 8, "#warning"); ftepp_next(ftepp); while (ftepp->token != TOKEN_EOL) { - vec_upload(message, ftepp_tokval(ftepp), strlen(ftepp_tokval(ftepp))); + vec_append(message, strlen(ftepp_tokval(ftepp)), ftepp_tokval(ftepp)); ftepp_next(ftepp); } vec_push(message, '\0'); @@ -1370,10 +1370,10 @@ static void ftepp_directive_error(ftepp_t *ftepp) { /* handle the odd non string constant case so it works like C */ if (ftepp->token != TOKEN_STRINGCONST) { - vec_upload(message, "#error", 6); + vec_append(message, 6, "#error"); ftepp_next(ftepp); while (ftepp->token != TOKEN_EOL) { - vec_upload(message, ftepp_tokval(ftepp), strlen(ftepp_tokval(ftepp))); + vec_append(message, strlen(ftepp_tokval(ftepp)), ftepp_tokval(ftepp)); ftepp_next(ftepp); } vec_push(message, '\0'); @@ -1398,10 +1398,10 @@ static void ftepp_directive_message(ftepp_t *ftepp) { /* handle the odd non string constant case so it works like C */ if (ftepp->token != TOKEN_STRINGCONST) { - vec_upload(message, "#message", 8); + vec_append(message, 8, "#message"); ftepp_next(ftepp); while (ftepp->token != TOKEN_EOL) { - vec_upload(message, ftepp_tokval(ftepp), strlen(ftepp_tokval(ftepp))); + vec_append(message, strlen(ftepp_tokval(ftepp)), ftepp_tokval(ftepp)); ftepp_next(ftepp); } vec_push(message, '\0'); @@ -1808,10 +1808,10 @@ void ftepp_add_macro(ftepp_t *ftepp, const char *name, const char *value) { return; } - vec_upload(create, "#define ", 8); - vec_upload(create, name, strlen(name)); + vec_append(create, 8, "#define "); + vec_append(create, strlen(name), name); vec_push (create, ' '); - vec_upload(create, value, strlen(value)); + vec_append(create, strlen(value), value); vec_push (create, 0); ftepp_preprocess_string(ftepp, "__builtin__", create); diff --git a/gmqcc.h b/gmqcc.h index 367b74f..576057a 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -380,7 +380,6 @@ void _util_vec_grow(void **a, size_t i, size_t s); #define vec_shrinkto(A,N) ((void)(vec_meta(A)->used = (N))) #define vec_shrinkby(A,N) ((void)(vec_meta(A)->used -= (N))) #define vec_append(A,N,S) ((void)(memcpy(vec_add((A), (N)), (S), (N) * sizeof(*(S))))) -#define vec_upload(X,Y,S) ((void)(memcpy(vec_add((X), (S) * sizeof(*(Y))), (Y), (S) * sizeof(*(Y))))) #define vec_remove(A,I,N) ((void)(memmove((A)+(I),(A)+((I)+(N)),sizeof(*(A))*(vec_meta(A)->used-(I)-(N))),vec_meta(A)->used-=(N))) typedef struct correct_trie_s { diff --git a/opts.c b/opts.c index 46496ca..98421a3 100644 --- a/opts.c +++ b/opts.c @@ -348,16 +348,16 @@ static char *opts_ini_load(const char *section, const char *name, const char *va strcmp(section, "warnings") && strcmp(section, "optimizations")) { - vec_upload(error, "invalid section `", 17); - vec_upload(error, section, strlen(section)); + vec_append(error, 17, "invalid section `"); + vec_append(error, strlen(section), section); vec_push (error, '`'); vec_push (error, '\0'); } else { - vec_upload(error, "invalid variable `", 18); - vec_upload(error, name, strlen(name)); + vec_append(error, 18, "invalid variable `"); + vec_append(error, strlen(name), name); vec_push (error, '`'); - vec_upload(error, " in section: `", 14); - vec_upload(error, section, strlen(section)); + vec_append(error, 14, " in section: `"); + vec_append(error, strlen(section), section); vec_push (error, '`'); vec_push (error, '\0'); }