git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Koegler <martin.koegler@chello.at>
To: git@vger.kernel.org, gitster@pobox.com, Johannes.Schindelin@gmx.de
Cc: Martin Koegler <martin.koegler@chello.at>
Subject: [Patch size_t V3 17/19] Convert ref-filter to size_t
Date: Wed, 16 Aug 2017 22:16:29 +0200	[thread overview]
Message-ID: <1502914591-26215-18-git-send-email-martin@mail.zuhause> (raw)
In-Reply-To: <1502914591-26215-1-git-send-email-martin@mail.zuhause>

From: Martin Koegler <martin.koegler@chello.at>

Signed-off-by: Martin Koegler <martin.koegler@chello.at>
---
 ref-filter.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/ref-filter.c b/ref-filter.c
index 5c903a5..30f249c 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -724,7 +724,7 @@ static int grab_objectname(const char *name, const unsigned char *sha1,
 }
 
 /* See grab_values */
-static void grab_common_values(struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
+static void grab_common_values(struct atom_value *val, int deref, struct object *obj, void *buf, size_t sz)
 {
 	int i;
 
@@ -739,7 +739,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
 			v->s = typename(obj->type);
 		else if (!strcmp(name, "objectsize")) {
 			v->value = sz;
-			v->s = xstrfmt("%lu", sz);
+			v->s = xstrfmt("%" PRIuMAX, (uintmax_t)sz);
 		}
 		else if (deref)
 			grab_objectname(name, obj->oid.hash, v, &used_atom[i]);
@@ -747,7 +747,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
 }
 
 /* See grab_values */
-static void grab_tag_values(struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
+static void grab_tag_values(struct atom_value *val, int deref, struct object *obj, void *buf, size_t sz)
 {
 	int i;
 	struct tag *tag = (struct tag *) obj;
@@ -769,7 +769,7 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
 }
 
 /* See grab_values */
-static void grab_commit_values(struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
+static void grab_commit_values(struct atom_value *val, int deref, struct object *obj, void *buf, size_t sz)
 {
 	int i;
 	struct commit *commit = (struct commit *) obj;
@@ -786,7 +786,7 @@ static void grab_commit_values(struct atom_value *val, int deref, struct object
 		}
 		else if (!strcmp(name, "numparent")) {
 			v->value = commit_list_count(commit->parents);
-			v->s = xstrfmt("%lu", (unsigned long)v->value);
+			v->s = xstrfmt("%" PRIuMAX, (uintmax_t)v->value);
 		}
 		else if (!strcmp(name, "parent")) {
 			struct commit_list *parents;
@@ -802,7 +802,7 @@ static void grab_commit_values(struct atom_value *val, int deref, struct object
 	}
 }
 
-static const char *find_wholine(const char *who, int wholen, const char *buf, unsigned long sz)
+static const char *find_wholine(const char *who, int wholen, const char *buf, size_t sz)
 {
 	const char *eol;
 	while (*buf) {
@@ -848,7 +848,7 @@ static const char *copy_email(const char *buf)
 	return xmemdupz(email, eoemail + 1 - email);
 }
 
-static char *copy_subject(const char *buf, unsigned long len)
+static char *copy_subject(const char *buf, size_t len)
 {
 	char *r = xmemdupz(buf, len);
 	int i;
@@ -898,7 +898,7 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
 }
 
 /* See grab_values */
-static void grab_person(const char *who, struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
+static void grab_person(const char *who, struct atom_value *val, int deref, struct object *obj, void *buf, size_t sz)
 {
 	int i;
 	int wholen = strlen(who);
@@ -957,11 +957,11 @@ static void grab_person(const char *who, struct atom_value *val, int deref, stru
 	}
 }
 
-static void find_subpos(const char *buf, unsigned long sz,
-			const char **sub, unsigned long *sublen,
-			const char **body, unsigned long *bodylen,
-			unsigned long *nonsiglen,
-			const char **sig, unsigned long *siglen)
+static void find_subpos(const char *buf, size_t sz,
+			const char **sub, size_t *sublen,
+			const char **body, size_t *bodylen,
+			size_t *nonsiglen,
+			const char **sig, size_t *siglen)
 {
 	const char *eol;
 	/* skip past header until we hit empty line */
@@ -1005,7 +1005,7 @@ static void find_subpos(const char *buf, unsigned long sz,
  * If 'lines' is greater than 0, append that many lines from the given
  * 'buf' of length 'size' to the given strbuf.
  */
-static void append_lines(struct strbuf *out, const char *buf, unsigned long size, int lines)
+static void append_lines(struct strbuf *out, const char *buf, size_t size, int lines)
 {
 	int i;
 	const char *sp, *eol;
@@ -1026,11 +1026,11 @@ static void append_lines(struct strbuf *out, const char *buf, unsigned long size
 }
 
 /* See grab_values */
-static void grab_sub_body_contents(struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
+static void grab_sub_body_contents(struct atom_value *val, int deref, struct object *obj, void *buf, size_t sz)
 {
 	int i;
 	const char *subpos = NULL, *bodypos = NULL, *sigpos = NULL;
-	unsigned long sublen = 0, bodylen = 0, nonsiglen = 0, siglen = 0;
+	size_t sublen = 0, bodylen = 0, nonsiglen = 0, siglen = 0;
 
 	for (i = 0; i < used_atom_cnt; i++) {
 		struct used_atom *atom = &used_atom[i];
@@ -1100,7 +1100,7 @@ static void fill_missing_values(struct atom_value *val)
  * pointed at by the ref itself; otherwise it is the object the
  * ref (which is a tag) refers to.
  */
-static void grab_values(struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
+static void grab_values(struct atom_value *val, int deref, struct object *obj, void *buf, size_t sz)
 {
 	grab_common_values(val, deref, obj, buf, sz);
 	switch (obj->type) {
-- 
2.1.4


  parent reply	other threads:[~2017-08-16 20:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16 20:16 [Patch size_t V3 00/19] use size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 01/19] delta: fix enconding size larger than an "uint" can hold Martin Koegler
2017-08-17 20:28   ` Torsten Bögershausen
2017-08-16 20:16 ` [Patch size_t V3 02/19] Convert size datatype to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 03/19] Convert zlib.c " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 04/19] delta: Fix offset overflows Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 05/19] Convert sha1_file.c to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 06/19] Use size_t for sha1 Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 07/19] Convert parse_X_buffer to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 08/19] Convert fsck.c & commit.c " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 09/19] Convert cache functions " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 10/19] Add overflow check to get_delta_hdr_size Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 11/19] Use size_t for config parsing Martin Koegler
2017-08-24 20:29   ` Johannes Sixt
2017-08-16 20:16 ` [Patch size_t V3 12/19] Convert pack-objects to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 13/19] Convert index-pack " Martin Koegler
2017-08-16 21:42   ` Ramsay Jones
2017-08-16 20:16 ` [Patch size_t V3 14/19] Convert unpack-objects " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 15/19] Convert archive functions " Martin Koegler
2017-08-21  6:42   ` Junio C Hamano
2017-08-22  1:19     ` brian m. carlson
2017-08-16 20:16 ` [Patch size_t V3 16/19] Convert various things " Martin Koegler
2017-08-21  6:34   ` Junio C Hamano
2017-08-16 20:16 ` Martin Koegler [this message]
2017-08-17 18:03   ` [Patch size_t V3 17/19] Convert ref-filter " Junio C Hamano
2017-08-17 18:04     ` Junio C Hamano
2017-08-16 20:16 ` [Patch size_t V3 18/19] Convert tree-walk " Martin Koegler
2017-08-17 17:53   ` Junio C Hamano
2017-08-16 20:16 ` [Patch size_t V3 19/19] Convert xdiff-interface " Martin Koegler
2017-08-17 17:49   ` Junio C Hamano
2017-08-16 21:33 ` [Patch size_t V3 00/19] use size_t Junio C Hamano
2017-08-17 20:35 ` Torsten Bögershausen
2017-08-18  7:08   ` Martin Koegler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502914591-26215-18-git-send-email-martin@mail.zuhause \
    --to=martin.koegler@chello.at \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).