]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
cat_n_send: get rid of bogus dependency on snprintf(). This should
authorJulian Seward <jseward@acm.org>
Wed, 20 Oct 2004 09:56:55 +0000 (09:56 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 20 Oct 2004 09:56:55 +0000 (09:56 +0000)
possibly go in the CVS repo.

git-svn-id: svn://svn.valgrind.org/vex/trunk@384

VEX/head20041019/coregrind/vg_libpthread.c

index cb017231642b7c9827f056f5d58a94f01b5d5efd..a10eaf05d58f5e00fcca9788e48bf76e90fbd020 100644 (file)
@@ -275,12 +275,27 @@ void barf ( const char* str )
 
 static void cat_n_send ( char* s1, char* s2, char* s3 )
 {
-   char  buf[1000];
+#  define N_BUF 1000
+   int  i;
+   char buf[N_BUF];
    if (get_pt_trace_level() >= 0) {
-      snprintf(buf, sizeof(buf), "%s%s%s", s1, s2, s3);
-      buf[sizeof(buf)-1] = '\0';
+      i = 0;
+      while (*s1) {
+         if (i >= N_BUF) break;
+         buf[i++] = *s1++;
+      }
+      while (*s2) {
+         if (i >= N_BUF) break;
+         buf[i++] = *s2++;
+      }
+      while (*s3) {
+         if (i >= N_BUF) break;
+         buf[i++] = *s3++;
+      }
+      buf[i] = 0;
       VALGRIND_INTERNAL_PRINTF(buf);
    }
+#  undef N_BUF
 }
 
 static void oh_dear ( char* fn, char* aux, char* s )