diff src/doc.c @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 9ee227acff29
line wrap: on
line diff
--- a/src/doc.c	Mon Aug 13 08:45:53 2007 +0200
+++ b/src/doc.c	Mon Aug 13 08:46:35 2007 +0200
@@ -111,7 +111,7 @@
 	  space_left = buffer_size - (p - buffer);
 	}
 
-      /* Don't read too too much at one go.  */
+      /* Don't read too much at one go.  */
       if (space_left > 1024 * 8)
 	space_left = 1024 * 8;
       nread = read (fd, p, space_left);
@@ -171,6 +171,12 @@
   return return_me;
 }
 
+#define string_join(dest, s1, s2) \
+  memcpy ((void *) dest, (void *) XSTRING_data (s1), XSTRING_length (s1)); \
+  memcpy ((void *) ((Bufbyte *) dest + XSTRING_length (s1)), \
+          (void *) XSTRING_data (s2), XSTRING_length (s2));  \
+          dest[XSTRING_length (s1) + XSTRING_length (s2)] = '\0'
+
 /* Extract a doc string from a file.  FILEPOS says where to get it.
    (This could actually be byte code instructions/constants instead
    of a doc string.)
@@ -227,8 +233,11 @@
 	minsize = 12;
       name_nonreloc
 	= (char *) alloca (minsize + string_length (XSTRING (file)) + 8);
+      /*
       strcpy (name_nonreloc, (char *) string_data (XSTRING (Vdoc_directory)));
       strcat (name_nonreloc, (char *) string_data (XSTRING (file)));
+      */
+      string_join (name_nonreloc, Vdoc_directory, file);
       munge_doc_file_name (name_nonreloc);
     }
   else