Re: [RFC/PATCH v4 09/49] Add initial external odb support

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

 





On 6/20/2017 3:54 AM, Christian Couder wrote:
From: Jeff King <peff@xxxxxxxx>

Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>

I'd suggest you make the function names consistent with the capabilities flags (ie get, put, have) both here in odb_helper.c/h and in external_odb.c/h.

+int odb_helper_has_object(struct odb_helper *o, const unsigned char *sha1);
+int odb_helper_fetch_object(struct odb_helper *o, const unsigned char *sha1,
+			    int fd);
+
+#endif /* ODB_HELPER_H */

The following patch fixes a few compiler warnings/errors.


diff --git a/odb-helper.c b/odb-helper.c
index 01cd6a713c..ffbbd2fc87 100644
--- a/odb-helper.c
+++ b/odb-helper.c
@@ -118,7 +118,7 @@ static int check_object_process_error(int err,
                                      unsigned int capability)
 {
        if (!err)
-               return;
+               return 0;

        if (!strcmp(status, "error")) {
                /* The process signaled a problem with the file. */
@@ -192,7 +192,7 @@ static ssize_t read_packetized_plain_object_to_fd(struct odb_helper *o,
        git_SHA1_Init(&hash);

        /* First header.. */
- hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1; + hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %"PRIuMAX, typename(type), size) + 1;
        stream.next_in = (unsigned char *)hdr;
        stream.avail_in = hdrlen;
        while (git_deflate(&stream, 0) == Z_OK)
@@ -253,7 +253,7 @@ static ssize_t read_packetized_plain_object_to_fd(struct odb_helper *o,
                return -1;
        }
        if (total_got != size) {
- warning("size mismatch from odb helper '%s' for %s (%lu != %lu)", + warning("size mismatch from odb helper '%s' for %s (%lu != %"PRIuMAX")",
                        o->name, sha1_to_hex(sha1), total_got, size);
                return -1;
        }
@@ -587,7 +587,6 @@ static int have_object_process(struct odb_helper *o)
        struct strbuf status = STRBUF_INIT;
        const char *cmd = o->cmd;
        uint64_t start;
-       char *line;
        int packet_len;
        int total_got = 0;

@@ -946,7 +945,7 @@ int odb_helper_for_each_object(struct odb_helper *o,
        return 0;
 }

-int odb_helper_write_plain_object(struct odb_helper *o,
+static int odb_helper_write_plain_object(struct odb_helper *o,
                                  const void *buf, size_t len,
                                  const char *type, unsigned char *sha1)
 {




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux