bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch3


From: Bear Giles
Subject: patch3
Date: Tue, 12 Jun 2001 21:39:38 -0600 (MDT)

diff -Naur --recursive cvs.orig/src/CVS/Entries cvs/src/CVS/Entries
--- cvs.orig/src/CVS/Entries    Tue Jun 12 20:31:45 2001
+++ cvs/src/CVS/Entries Tue Jun 12 21:07:29 2001
@@ -9,13 +9,13 @@
 /add.c/1.2/Tue Jun 12 23:43:12 2001/-ko/
 /admin.c/1.1.1.1/Sun Jun 10 04:09:03 2001/-ko/
 /annotate.c/1.1.1.1/Sun Jun 10 04:09:03 2001/-ko/
-/buffer.c/1.3/Wed Jun 13 02:30:34 2001/-ko/
-/buffer.h/1.3/Wed Jun 13 02:30:34 2001/-ko/
+/buffer.c/1.4/Wed Jun 13 03:05:25 2001/-ko/
+/buffer.h/1.4/Wed Jun 13 03:05:25 2001/-ko/
 /build_src.com/1.1.1.1/Sun Jun 10 04:09:10 2001/-ko/
 /checkin.c/1.2/Tue Jun 12 23:43:12 2001/-ko/
 /checkout.c/1.1.1.1/Sun Jun 10 04:09:03 2001/-ko/
 /classify.c/1.1.1.1/Sun Jun 10 04:09:04 2001/-ko/
-/client.c/1.2/Tue Jun 12 23:43:12 2001/-ko/
+/client.c/1.3/Wed Jun 13 03:05:25 2001/-ko/
 /client.h/1.2/Tue Jun 12 23:43:12 2001/-ko/
 /commit.c/1.2/Tue Jun 12 23:43:12 2001/-ko/
 /create_adm.c/1.1.1.1/Sun Jun 10 04:09:04 2001/-ko/
@@ -64,13 +64,13 @@
 /run.c/1.1.1.1/Sun Jun 10 04:09:07 2001/-ko/
 /sanity.sh/1.1.1.1/Sun Jun 10 04:09:13 2001/-ko/
 /scramble.c/1.1.1.1/Sun Jun 10 04:09:07 2001/-ko/
-/server.c/1.3/Wed Jun 13 02:30:34 2001/-ko/
+/server.c/1.4/Wed Jun 13 03:05:25 2001/-ko/
 /server.h/1.1.1.1/Sun Jun 10 04:09:09 2001/-ko/
 /stamp-h2.in/1.1.1.1/Sun Jun 10 04:09:02 2001/-ko/
 /status.c/1.1.1.1/Sun Jun 10 04:09:07 2001/-ko/
 /subr.c/1.1.1.1/Sun Jun 10 04:09:07 2001/-ko/
 /tag.c/1.1.1.1/Sun Jun 10 04:09:08 2001/-ko/
-/update.c/1.2/Tue Jun 12 23:43:12 2001/-ko/
+/update.c/1.3/Wed Jun 13 03:05:25 2001/-ko/
 /update.h/1.1.1.1/Sun Jun 10 04:09:09 2001/-ko/
 /vers_ts.c/1.1.1.1/Sun Jun 10 04:09:08 2001/-ko/
 /version.c/1.1.1.1/Sun Jun 10 04:09:09 2001/-ko/
@@ -78,5 +78,5 @@
 /watch.c/1.1.1.1/Sun Jun 10 04:09:08 2001/-ko/
 /watch.h/1.1.1.1/Sun Jun 10 04:09:09 2001/-ko/
 /wrapper.c/1.1.1.1/Sun Jun 10 04:09:08 2001/-ko/
-/zlib.c/1.2/Tue Jun 12 23:43:13 2001/-ko/
+/zlib.c/1.3/Wed Jun 13 03:05:25 2001/-ko/
 D
diff -Naur --recursive cvs.orig/src/buffer.c cvs/src/buffer.c
--- cvs.orig/src/buffer.c       Tue Jun 12 20:30:34 2001
+++ cvs/src/buffer.c    Tue Jun 12 21:05:25 2001
@@ -50,8 +50,8 @@
 
 /* Free a buffer structure.  */
 
-void
-buf_free (buf)
+int
+bclose (buf)
      BUFFER *buf;
 {
     if (buf->data != NULL)
@@ -60,6 +60,8 @@
        free_buffer_data = buf->data;
     }
     free (buf);
+
+       return 0;
 }
 
 /* Initialize a buffer structure which is not to be used for I/O.  */
@@ -165,14 +167,17 @@
 }
 #endif /* SERVER_FLOWCONTROL */
 
-/* Add data DATA of length LEN to BUF.  */
+/* Add data DATA of length SIZE * NMEMB to BUF.  */
 
-void
-buf_output (buf, data, len)
+ssize_t
+bwrite (ptr, size, nmemb, buf)
+    const void *ptr;
+    size_t size;
+       size_t nmemb;
     BUFFER *buf;
-    const char *data;
-    int len;
 {
+    const char *data = (const char *) ptr;
+       size_t len = size * nmemb;
     if (buf->data != NULL
        && (((buf->last->text + BUFFER_DATA_SIZE)
             - (buf->last->bufp + buf->last->size))
@@ -180,7 +185,7 @@
     {
        memcpy (buf->last->bufp + buf->last->size, data, len);
        buf->last->size += len;
-       return;
+       return nmemb;
     }
 
     while (1)
@@ -191,7 +196,7 @@
        if (newdata == NULL)
        {
            (*buf->memory_error) (buf);
-           return;
+           return -1;
        }
 
        if (buf->data == NULL)
@@ -207,7 +212,7 @@
        {
            newdata->size = len;
            memcpy (newdata->text, data, len);
-           return;
+           return nmemb;
        }
 
        newdata->size = BUFFER_DATA_SIZE;
@@ -228,7 +233,7 @@
     BUFFER *buf;
 {
        size_t count = strlen (string);
-    buf_output (buf, string, count);
+    bwrite (string, 1, count, buf);
 
        return count;
 }
@@ -252,7 +257,7 @@
        char b;
 
        b = ch;
-       buf_output (buf, &b, 1);
+       bwrite (&b, 1, 1, buf);
     }
 
        return ch;
@@ -1032,7 +1037,7 @@
        }
        else
        {
-           buf_output (outbuf, nldata->bufp, len);
+           bwrite (nldata->bufp, 1, len, outbuf);
            nldata->bufp += len;
            nldata->size -= len;
        }
@@ -1187,7 +1192,7 @@
 
        if (stopwant > 0)
        {
-           buf_output (outbuf, stop->bufp, stopwant);
+           bwrite (stop->bufp, 1, stopwant, outbuf);
            stop->bufp += stopwant;
            stop->size -= stopwant;
        }
@@ -1688,7 +1693,7 @@
     /* The output function is permitted to add up to PACKET_SLOP
        bytes, and we need 2 bytes for the size of the translated data.
        If we can guarantee that the result will fit in a buffer_data,
-       we translate directly into one to avoid a memcpy in buf_output.  */
+       we translate directly into one to avoid a memcpy in bwrite.  */
     if (size + PACKET_SLOP + 2 > BUFFER_DATA_SIZE)
        outbuf = stack_outbuf;
     else
@@ -1720,7 +1725,7 @@
     outbuf[1] = translated & 0xff;
 
     if (outbuf == stack_outbuf)
-       buf_output (pb->buf, outbuf, translated + 2);
+       bwrite (outbuf, 1, translated + 2, pb->buf);
     else
     {
        outdata->size = translated + 2;
diff -Naur --recursive cvs.orig/src/buffer.h cvs/src/buffer.h
--- cvs.orig/src/buffer.h       Tue Jun 12 20:30:34 2001
+++ cvs/src/buffer.h    Tue Jun 12 21:05:25 2001
@@ -108,7 +108,7 @@
                                            int (*) (void *),
                                            void (*) (BUFFER *),
                                            void *));
-extern void buf_free PROTO((BUFFER *));
+extern int bclose PROTO((BUFFER *));
 extern BUFFER *buf_nonio_initialize PROTO((void (*) (BUFFER *)));
 extern BUFFER *stdio_buffer_initialize
   PROTO((FILE *, int, void (*) (BUFFER *)));
@@ -119,7 +119,7 @@
         int (*) (void *, const char *, char *, int, int *), void *,
         void (*) (BUFFER *)));
 extern int buf_empty_p PROTO((BUFFER *));
-extern void buf_output PROTO((BUFFER *, const char *, int));
+extern ssize_t bwrite PROTO((const void *, size_t, size_t, BUFFER *));
 extern int bputs PROTO((const char *, BUFFER *));
 extern int bputc PROTO((int, BUFFER *));
 extern int buf_send_output PROTO((BUFFER *));
diff -Naur --recursive cvs.orig/src/client.c cvs/src/client.c
--- cvs.orig/src/client.c       Tue Jun 12 17:43:12 2001
+++ cvs/src/client.c    Tue Jun 12 21:05:25 2001
@@ -3388,7 +3388,7 @@
     if (len == 0)
        len = strlen (str);
 
-    buf_output (to_server, str, len);
+    bwrite (str, 1, len, to_server);
       
     /* There is no reason not to send data to the server, so do it
        whenever we've accumulated enough information in the buffer to
@@ -3621,8 +3621,8 @@
        && waitpid (rsh_pid, (int *) 0, 0) == -1)
        error (1, errno, "waiting for process %d", rsh_pid);
 
-    buf_free (to_server);
-    buf_free (from_server);
+    bclose (to_server);
+    bclose (from_server);
     server_started = 0;
 
     /* see if we need to sleep before returning to avoid time-stamp races */
diff -Naur --recursive cvs.orig/src/server.c cvs/src/server.c
--- cvs.orig/src/server.c       Tue Jun 12 20:30:34 2001
+++ cvs/src/server.c    Tue Jun 12 21:05:25 2001
@@ -2354,15 +2354,15 @@
     {
        char *update_dir;
 
-       buf_output (buf_to_net, "M ? ", 4);
+       bwrite ("M ? ", 1, 4, buf_to_net);
        update_dir = dir_name + strlen (server_temp_dir) + 1;
        if (!(update_dir[0] == '.' && update_dir[1] == '\0'))
        {
            bputs (update_dir, buf_to_net);
-           buf_output (buf_to_net, "/", 1);
+           bputc ('/', buf_to_net);
        }
        bputs (arg, buf_to_net);
-       buf_output (buf_to_net, "\n", 1);
+       bputc ('\n', buf_to_net);
     }
 }
 
@@ -2799,7 +2799,7 @@
        {
            bputs (supported_response ("MT") ? "MT text " : "M ", protocol);
            buf_append_buffer (protocol, saved_output);
-           buf_output (protocol, "\n", 1);
+           bputc ('\n', protocol);
            buf_send_counted (protocol);
        }
        /* For now we just discard partial lines on stderr.  I suspect
@@ -2809,7 +2809,7 @@
         * When we exit, that will close the pipes, giving an EOF to
         * the parent.
         */
-       buf_free (protocol);
+       bclose (protocol);
        exit (exitstatus);
     }
 
@@ -3206,11 +3206,11 @@
        set_block (buf_to_net);
        buf_flush (buf_to_net, 1);
        buf_shutdown (protocol_inbuf);
-       buf_free (protocol_inbuf);
+       bclose (protocol_inbuf);
        buf_shutdown (stderrbuf);
-       buf_free (stderrbuf);
+       bclose (stderrbuf);
        buf_shutdown (stdoutbuf);
-       buf_free (stdoutbuf);
+       bclose (stdoutbuf);
     }
 
     if (errs)
@@ -3494,7 +3494,7 @@
     if (entries_line)
     {
        bputs (entries_line, protocol);
-       buf_output (protocol, "\n", 1);
+       bputc ('\n', protocol);
     }
     else
        /* Return the error message as the Entries line.  */
@@ -3542,7 +3542,7 @@
     bputs ("Checked-in ", protocol);
     output_dir (update_dir, repository);
     bputs (file, protocol);
-    buf_output (protocol, "\n", 1);
+    bputc ('\n', protocol);
     new_entries_line ();
 }
 
@@ -3563,7 +3563,7 @@
        bputs ("Remove-entry ", protocol);
        output_dir (update_dir, repository);
        bputs (file, protocol);
-       buf_output (protocol, "\n", 1);
+       bputc ('\n', protocol);
        free (scratched_file);
        scratched_file = NULL;
     }
@@ -3592,7 +3592,7 @@
        bputs ("New-entry ", protocol);
        output_dir (update_dir, repository);
        bputs (file, protocol);
-       buf_output (protocol, "\n", 1);
+       bputc ('\n', protocol);
        new_entries_line ();
     }
 
@@ -4081,7 +4081,7 @@
            abort ();
        output_dir (finfo->update_dir, finfo->repository);
        bputs (finfo->file, protocol);
-       buf_output (protocol, "\n", 1);
+       bputc ('\n', protocol);
 
        new_entries_line ();
 
@@ -4168,7 +4168,7 @@
 
        if (file != NULL)
        {
-           buf_output (protocol, (char *) file, file_used);
+           bwrite ((char *) file, 1, file_used, protocol);
            free (file);
            file = NULL;
        }
@@ -4177,7 +4177,7 @@
        else
        {
            buf_append_buffer (protocol, filebuf);
-           buf_free (filebuf);
+           bclose (filebuf);
        }
        /* Note we only send a newline here if the file ended with one.  */
 
@@ -4217,7 +4217,7 @@
            bputs ("Remove-entry ", protocol);
        output_dir (finfo->update_dir, finfo->repository);
        bputs (finfo->file, protocol);
-       buf_output (protocol, "\n", 1);
+       bputc ('\n', protocol);
        /* keep the vers structure up to date in case we do a join
         * - if there isn't a file, it can't very well have a version number, 
can it?
         *
@@ -4385,7 +4385,7 @@
     while (!feof (fp))
     {
        n = fread (buf, 1, sizeof buf, fp);
-       buf_output (protocol, buf, n);
+       bwrite (buf, 1, n, protocol);
        if (ferror (fp))
        {
            error (0, errno, "cannot read rcsinfo template file %s", template);
@@ -6325,12 +6325,12 @@
 #ifdef SERVER_SUPPORT
     if (error_use_protocol)
     {
-       buf_output (saved_output, str, len);
+       bwrite (str, 1, len, saved_output);
        buf_copy_lines (buf_to_net, saved_output, 'M');
     }
     else if (server_active)
     {
-       buf_output (saved_output, str, len);
+       bwrite (str, 1, len, saved_output);
        buf_copy_lines (protocol, saved_output, 'M');
        buf_send_counted (protocol);
     }
@@ -6392,7 +6392,7 @@
        /* Not sure what would be involved in using buf_append_data here
           without stepping on the toes of our caller (which is responsible
           for the memory allocation of STR).  */
-       buf_output (buf, str, len);
+       bwrite (str, 1, len, buf);
 
        if (!error_use_protocol)
            buf_send_counted (protocol);
@@ -6455,12 +6455,12 @@
 #ifdef SERVER_SUPPORT
     if (error_use_protocol)
     {
-       buf_output (saved_outerr, str, len);
+       bwrite (str, 1, len, saved_outerr);
        buf_copy_lines (buf_to_net, saved_outerr, 'E');
     }
     else if (server_active)
     {
-       buf_output (saved_outerr, str, len);
+       bwrite (str, 1, len, saved_outerr);
        buf_copy_lines (protocol, saved_outerr, 'E');
        buf_send_counted (protocol);
     }
@@ -6591,10 +6591,10 @@
        bputs (tag, buf);
        if (text != NULL)
        {
-           buf_output (buf, " ", 1);
+           bputc (' ', buf);
            bputs (text, buf);
        }
-       buf_output (buf, "\n", 1);
+       bputc ('\n', buf);
 
        if (!error_use_protocol)
            buf_send_counted (protocol);
diff -Naur --recursive cvs.orig/src/update.c cvs/src/update.c
--- cvs.orig/src/update.c       Tue Jun 12 17:43:12 2001
+++ cvs/src/update.c    Tue Jun 12 21:05:25 2001
@@ -1569,7 +1569,7 @@
 {
     BUFFER *buf = (BUFFER *) callerdat;
 
-    buf_output (buf, data, len);
+    bwrite (data, 1, len, buf);
 }
 
 #endif /* SERVER_SUPPORT */
diff -Naur --recursive cvs.orig/src/zlib.c cvs/src/zlib.c
--- cvs.orig/src/zlib.c Tue Jun 12 17:43:13 2001
+++ cvs/src/zlib.c      Tue Jun 12 21:05:25 2001
@@ -275,8 +275,8 @@
        }
 
        if (cb->zstr.avail_out != BUFFER_DATA_SIZE)
-           buf_output (cb->buf, buffer,
-                       BUFFER_DATA_SIZE - cb->zstr.avail_out);
+           bwrite (buffer, 1,
+                       BUFFER_DATA_SIZE - cb->zstr.avail_out, cb->buf);
     }
 
     *wrote = have;
@@ -321,8 +321,8 @@
        }
 
        if (cb->zstr.avail_out != BUFFER_DATA_SIZE)
-           buf_output (cb->buf, buffer,
-                       BUFFER_DATA_SIZE - cb->zstr.avail_out);
+           bwrite (buffer, 1,
+                       BUFFER_DATA_SIZE - cb->zstr.avail_out, cb->buf);
 
        /* If the deflate function did not fill the output buffer,
            then all data has been flushed.  */
@@ -408,8 +408,8 @@
        }
 
        if (cb->zstr.avail_out != BUFFER_DATA_SIZE)
-           buf_output (cb->buf, buffer,
-                       BUFFER_DATA_SIZE - cb->zstr.avail_out);
+           bwrite (buffer, 1,
+                       BUFFER_DATA_SIZE - cb->zstr.avail_out, cb->buf);
     } while (zstatus != Z_STREAM_END);
 
     zstatus = deflateEnd (&cb->zstr);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]