Added SILC Server library.
[silc.git] / lib / silcsim / silcsimutil.c
index a47b68ad1d84af8cfc1597794139fba7aa2fa4f4..67cb5bf1350f640d9e21cbd176b0661c666fa536 100644 (file)
@@ -2,14 +2,13 @@
 
   silcsimutil.c
 
-  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+  Author: Pekka Riikonen <priikone@silcnet.org>
 
   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
 
 */
 
-#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 */