X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcsim%2Fsilcsimutil.c;h=67cb5bf1350f640d9e21cbd176b0661c666fa536;hb=40f8443d8d3a6577336ee66d18e04d9ac4d956bb;hp=a47b68ad1d84af8cfc1597794139fba7aa2fa4f4;hpb=62f89b2886bbe9df82d9b2fdabfe707509d9e0fc;p=silc.git diff --git a/lib/silcsim/silcsimutil.c b/lib/silcsim/silcsimutil.c index a47b68ad..67cb5bf1 100644 --- a/lib/silcsim/silcsimutil.c +++ b/lib/silcsim/silcsimutil.c @@ -2,14 +2,13 @@ silcsimutil.c - Author: Pekka Riikonen + Author: Pekka Riikonen Copyright (C) 2000 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,31 +17,30 @@ */ -#include "silcincludes.h" +#include "silc.h" #ifdef SILC_SIM /* SIM support enabled */ -/* This puts two arguments together and returns a new allocated string. - This is used to produce the function names that are then get from +static char symname[256]; + +/* This is used to produce the function names that are then get from SIM's. */ char *silc_sim_symname(char *symbol, char *function) { - char *ret; int len1, len2, len3; len1 = strlen(symbol); len2 = strlen(function); len3 = strlen(SILC_SIM_SYMBOL_PREFIX); - ret = silc_calloc(len1 + len2 + len3 + 2 + 1, sizeof(char)); - - strncpy(ret, SILC_SIM_SYMBOL_PREFIX, len3); - strncat(ret, "_", 1); - strncat(ret, symbol, len1); - strncat(ret, "_", 1); - strncat(ret, function, len2); - - return ret; + memset(symname, 0, sizeof(symname)); + silc_strncat(symname, sizeof(symname), SILC_SIM_SYMBOL_PREFIX, len3); + silc_strncat(symname, sizeof(symname), "_", 1); + silc_strncat(symname, sizeof(symname), symbol, len1); + silc_strncat(symname, sizeof(symname), "_", 1); + silc_strncat(symname, sizeof(symname), function, len2); + + return symname; } #endif /* SILC_SIM */