git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* [PATCH] Fixed pervasive enumeration warning in convert.h.
@ 2018-01-12 16:36 randall.s.becker
  2018-01-12 19:25 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: randall.s.becker @ 2018-01-12 16:36 UTC (permalink / raw)
  To: git; +Cc: Randall S. Becker

From: "Randall S. Becker" <rsbecker@nexbridge.com>

The actual enum value should be used rather than 0 and was causing
a warning in an inline proc.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
---
 convert.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/convert.h b/convert.h
index 4f2da22..a9a6658 100644
--- a/convert.h
+++ b/convert.h
@@ -79,7 +79,7 @@ extern int renormalize_buffer(const struct index_state *istate,
 static inline int would_convert_to_git(const struct index_state *istate,
 				       const char *path)
 {
-	return convert_to_git(istate, path, NULL, 0, NULL, 0);
+	return convert_to_git(istate, path, NULL, 0, NULL, SAFE_CRLF_FALSE);
 }
 /* Precondition: would_convert_to_git_filter_fd(path) == true */
 extern void convert_to_git_filter_fd(const struct index_state *istate,
-- 
2.8.5.23.g6fa7ec3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fixed pervasive enumeration warning in convert.h.
  2018-01-12 16:36 [PATCH] Fixed pervasive enumeration warning in convert.h randall.s.becker
@ 2018-01-12 19:25 ` Junio C Hamano
  2018-01-12 19:52   ` Randall S. Becker
  2018-01-13 22:49   ` [PATCH v1 1/1] convert_to_git(): safe_crlf/checksafe becomes int conv_flags tboegi
  0 siblings, 2 replies; 6+ messages in thread
From: Junio C Hamano @ 2018-01-12 19:25 UTC (permalink / raw)
  To: randall.s.becker
  Cc: git, Randall S. Becker, Torsten Bögershausen, Lars Schneider

randall.s.becker@rogers.com writes:

> From: "Randall S. Becker" <rsbecker@nexbridge.com>
>
> The actual enum value should be used rather than 0 and was causing
> a warning in an inline proc.
>
> Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
> ---
>  convert.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/convert.h b/convert.h
> index 4f2da22..a9a6658 100644
> --- a/convert.h
> +++ b/convert.h
> @@ -79,7 +79,7 @@ extern int renormalize_buffer(const struct index_state *istate,
>  static inline int would_convert_to_git(const struct index_state *istate,
>  				       const char *path)
>  {
> -	return convert_to_git(istate, path, NULL, 0, NULL, 0);
> +	return convert_to_git(istate, path, NULL, 0, NULL, SAFE_CRLF_FALSE);
>  }

I think this is being solved a bit differently with a1fbf854
("convert_to_git(): safe_crlf/checksafe becomes int conv_flags",
2018-01-06), and 0 becomes the right value to pass at this caller to
say "I am passing none of the flag bit".

I am hoping that the series that ends at f3b11d54 ("convert: add
support for 'checkout-encoding' attribute", 2018-01-06) will be
rerolled and hit 'master' early in the next cycle.

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] Fixed pervasive enumeration warning in convert.h.
  2018-01-12 19:25 ` Junio C Hamano
@ 2018-01-12 19:52   ` Randall S. Becker
  2018-01-13 17:13     ` unused variable in hashmap.h [was: Re: [PATCH] Fixed pervasive enumeration warning in convert.h.] René Scharfe
  2018-01-13 22:49   ` [PATCH v1 1/1] convert_to_git(): safe_crlf/checksafe becomes int conv_flags tboegi
  1 sibling, 1 reply; 6+ messages in thread
From: Randall S. Becker @ 2018-01-12 19:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Torsten Bögershausen, Lars Schneider

> From: Junio C Hamano [mailto:gitster@pobox.com]
On January 12, 2018 2:25 PM, Junio C Hamano wrote:
> > From: "Randall S. Becker" <rsbecker@nexbridge.com>
> >  {
> > -	return convert_to_git(istate, path, NULL, 0, NULL, 0);
> > +	return convert_to_git(istate, path, NULL, 0, NULL,
> SAFE_CRLF_FALSE);
> >  }
> 
> I think this is being solved a bit differently with a1fbf854
> ("convert_to_git(): safe_crlf/checksafe becomes int conv_flags", 2018-01-
> 06), and 0 becomes the right value to pass at this caller to say "I am passing
> none of the flag bit".
> 
> I am hoping that the series that ends at f3b11d54 ("convert: add support for
> 'checkout-encoding' attribute", 2018-01-06) will be rerolled and hit 'master'
> early in the next cycle.

Got it. Will revert this one on my end. On a related too many warnings subject, hashmap.h has a variable unused (void *item). Is that addressed soon? If not, I can deal with it.

Cheers,
Randall
(also, sorry about the other email address in use. It's the only way I can use send-email, fixing the annoying prior wrapping/tab/space garbage I had).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* unused variable in hashmap.h [was: Re: [PATCH] Fixed pervasive enumeration warning in convert.h.]
  2018-01-12 19:52   ` Randall S. Becker
@ 2018-01-13 17:13     ` René Scharfe
  2018-01-13 17:30       ` Randall S. Becker
  0 siblings, 1 reply; 6+ messages in thread
From: René Scharfe @ 2018-01-13 17:13 UTC (permalink / raw)
  To: Randall S. Becker
  Cc: Junio C Hamano, git, Torsten Bögershausen, Lars Schneider,
	Jeff Hostetler

Am 12.01.2018 um 20:52 schrieb Randall S. Becker:
> On a related too many warnings subject, hashmap.h has a variable
> unused (void *item). Is that addressed soon? If not, I can deal with
> it.
Here are the code lines containing the variable in question:

        void *item;
        while ((item = hashmap_iter_next(&iter)))

Intriguing.  The variable "item" is set, but can be removed without
effect.  GCC 7.2 and Clang 5 don't warn about that.

The code was introduced by 8b604d1951 (hashmap: add API to disable item
counting when threaded) and there is no patch in pu that touches it
again, yet.

René

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: unused variable in hashmap.h [was: Re: [PATCH] Fixed pervasive enumeration warning in convert.h.]
  2018-01-13 17:13     ` unused variable in hashmap.h [was: Re: [PATCH] Fixed pervasive enumeration warning in convert.h.] René Scharfe
@ 2018-01-13 17:30       ` Randall S. Becker
  0 siblings, 0 replies; 6+ messages in thread
From: Randall S. Becker @ 2018-01-13 17:30 UTC (permalink / raw)
  To: René Scharfe
  Cc: Junio C Hamano, git, Torsten Bögershausen, Lars Schneider,
	Jeff Hostetler

> Sent: On January 13, 2018 12:13 PM, René Scharfe wrote:
> Am 12.01.2018 um 20:52 schrieb Randall S. Becker:
> > On a related too many warnings subject, hashmap.h has a variable
> > unused (void *item). Is that addressed soon? If not, I can deal with
> > it.
> Here are the code lines containing the variable in question:
> 
>         void *item;
>         while ((item = hashmap_iter_next(&iter)))
> 
> Intriguing.  The variable "item" is set, but can be removed without effect.
> GCC 7.2 and Clang 5 don't warn about that.
> 
> The code was introduced by 8b604d1951 (hashmap: add API to disable item
> counting when threaded) and there is no patch in pu that touches it again,

I was thinking about just changing it to the following and submitting the trivial patch:

         while (hashmap_iter_next(&iter))

Avoids the frame allocation of void *item so should make it minimally faster when compiled without optimization. 

Cheers,
Randall


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/1] convert_to_git(): safe_crlf/checksafe becomes int conv_flags
  2018-01-12 19:25 ` Junio C Hamano
  2018-01-12 19:52   ` Randall S. Becker
@ 2018-01-13 22:49   ` tboegi
  1 sibling, 0 replies; 6+ messages in thread
From: tboegi @ 2018-01-13 22:49 UTC (permalink / raw)
  To: randall.s.becker, rsbecker, git, larsxschneider; +Cc: Torsten Bögershausen

From: Torsten Bögershausen <tboegi@web.de>

When calling convert_to_git(), the checksafe parameter defined what
should happen if the EOL conversion (CRLF --> LF --> CRLF) does not
roundtrip cleanly. In addition, it also defined if line endings should
be renormalized (CRLF --> LF) or kept as they are.

checksafe was an safe_crlf enum with these values:
SAFE_CRLF_FALSE:       do nothing in case of EOL roundtrip errors
SAFE_CRLF_FAIL:        die in case of EOL roundtrip errors
SAFE_CRLF_WARN:        print a warning in case of EOL roundtrip errors
SAFE_CRLF_RENORMALIZE: change CRLF to LF
SAFE_CRLF_KEEP_CRLF:   keep all line endings as they are

In some cases the integer value 0 was passed as checksafe parameter
instead of the correct enum value SAFE_CRLF_FALSE. That was no problem
because SAFE_CRLF_FALSE is defined as 0.

FALSE/FAIL/WARN are different from RENORMALIZE and KEEP_CRLF. Therefore,
an enum is not ideal. Let's use a integer bit pattern instead and rename
the parameter to conv_flags to make it more generically usable. This
allows us to extend the bit pattern in a subsequent commit.

Reported-By: Randall S. Becker <rsbecker@nexbridge.com>
Helped-By: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---

 >I think this is being solved a bit differently with a1fbf854
 >("convert_to_git(): safe_crlf/checksafe becomes int conv_flags",
 >2018-01-06), and 0 becomes the right value to pass at this caller to
 >say "I am passing none of the flag bit".

 >I am hoping that the series that ends at f3b11d54 ("convert: add
 >support for 'checkout-encoding' attribute", 2018-01-06) will be
 >rerolled and hit 'master' early in the next cycle.

  Thanks for the report & suggested patch. After reading it, I suggest
  to break out the enum/int fix into an own "series".


apply.c        |  6 +++---
 combine-diff.c |  2 +-
 config.c       |  7 +++++--
 convert.c      | 38 +++++++++++++++++++-------------------
 convert.h      | 17 +++++++----------
 diff.c         |  8 ++++----
 environment.c  |  2 +-
 sha1_file.c    | 12 ++++++------
 8 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/apply.c b/apply.c
index 321a9fa68..f8b67bfee 100644
--- a/apply.c
+++ b/apply.c
@@ -2263,8 +2263,8 @@ static void show_stats(struct apply_state *state, struct patch *patch)
 static int read_old_data(struct stat *st, struct patch *patch,
 			 const char *path, struct strbuf *buf)
 {
-	enum safe_crlf safe_crlf = patch->crlf_in_old ?
-		SAFE_CRLF_KEEP_CRLF : SAFE_CRLF_RENORMALIZE;
+	int conv_flags = patch->crlf_in_old ?
+		CONV_EOL_KEEP_CRLF : CONV_EOL_RENORMALIZE;
 	switch (st->st_mode & S_IFMT) {
 	case S_IFLNK:
 		if (strbuf_readlink(buf, path, st->st_size) < 0)
@@ -2281,7 +2281,7 @@ static int read_old_data(struct stat *st, struct patch *patch,
 		 * should never look at the index when explicit crlf option
 		 * is given.
 		 */
-		convert_to_git(NULL, path, buf->buf, buf->len, buf, safe_crlf);
+		convert_to_git(NULL, path, buf->buf, buf->len, buf, conv_flags);
 		return 0;
 	default:
 		return -1;
diff --git a/combine-diff.c b/combine-diff.c
index 2505de119..19f30c335 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1053,7 +1053,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 			if (is_file) {
 				struct strbuf buf = STRBUF_INIT;
 
-				if (convert_to_git(&the_index, elem->path, result, len, &buf, safe_crlf)) {
+				if (convert_to_git(&the_index, elem->path, result, len, &buf, global_conv_flags_eol)) {
 					free(result);
 					result = strbuf_detach(&buf, &len);
 					result_size = len;
diff --git a/config.c b/config.c
index e617c2018..1f003fbb9 100644
--- a/config.c
+++ b/config.c
@@ -1149,11 +1149,14 @@ static int git_default_core_config(const char *var, const char *value)
 	}
 
 	if (!strcmp(var, "core.safecrlf")) {
+		int eol_rndtrp_die;
 		if (value && !strcasecmp(value, "warn")) {
-			safe_crlf = SAFE_CRLF_WARN;
+			global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
 			return 0;
 		}
-		safe_crlf = git_config_bool(var, value);
+		eol_rndtrp_die = git_config_bool(var, value);
+		global_conv_flags_eol = eol_rndtrp_die ?
+			CONV_EOL_RNDTRP_DIE : CONV_EOL_RNDTRP_WARN;
 		return 0;
 	}
 
diff --git a/convert.c b/convert.c
index 1a41a48e1..b976eb968 100644
--- a/convert.c
+++ b/convert.c
@@ -193,30 +193,30 @@ static enum eol output_eol(enum crlf_action crlf_action)
 	return core_eol;
 }
 
-static void check_safe_crlf(const char *path, enum crlf_action crlf_action,
+static void check_global_conv_flags_eol(const char *path, enum crlf_action crlf_action,
 			    struct text_stat *old_stats, struct text_stat *new_stats,
-			    enum safe_crlf checksafe)
+			    int conv_flags)
 {
 	if (old_stats->crlf && !new_stats->crlf ) {
 		/*
 		 * CRLFs would not be restored by checkout
 		 */
-		if (checksafe == SAFE_CRLF_WARN)
+		if (conv_flags & CONV_EOL_RNDTRP_DIE)
+			die(_("CRLF would be replaced by LF in %s."), path);
+		else if (conv_flags & CONV_EOL_RNDTRP_WARN)
 			warning(_("CRLF will be replaced by LF in %s.\n"
 				  "The file will have its original line"
 				  " endings in your working directory."), path);
-		else /* i.e. SAFE_CRLF_FAIL */
-			die(_("CRLF would be replaced by LF in %s."), path);
 	} else if (old_stats->lonelf && !new_stats->lonelf ) {
 		/*
 		 * CRLFs would be added by checkout
 		 */
-		if (checksafe == SAFE_CRLF_WARN)
+		if (conv_flags & CONV_EOL_RNDTRP_DIE)
+			die(_("LF would be replaced by CRLF in %s"), path);
+		else if (conv_flags & CONV_EOL_RNDTRP_WARN)
 			warning(_("LF will be replaced by CRLF in %s.\n"
 				  "The file will have its original line"
 				  " endings in your working directory."), path);
-		else /* i.e. SAFE_CRLF_FAIL */
-			die(_("LF would be replaced by CRLF in %s"), path);
 	}
 }
 
@@ -268,7 +268,7 @@ static int will_convert_lf_to_crlf(size_t len, struct text_stat *stats,
 static int crlf_to_git(const struct index_state *istate,
 		       const char *path, const char *src, size_t len,
 		       struct strbuf *buf,
-		       enum crlf_action crlf_action, enum safe_crlf checksafe)
+		       enum crlf_action crlf_action, int conv_flags)
 {
 	struct text_stat stats;
 	char *dst;
@@ -298,12 +298,12 @@ static int crlf_to_git(const struct index_state *istate,
 		 * unless we want to renormalize in a merge or
 		 * cherry-pick.
 		 */
-		if ((checksafe != SAFE_CRLF_RENORMALIZE) &&
+		if ((!(conv_flags & CONV_EOL_RENORMALIZE)) &&
 		    has_crlf_in_index(istate, path))
 			convert_crlf_into_lf = 0;
 	}
-	if ((checksafe == SAFE_CRLF_WARN ||
-	    (checksafe == SAFE_CRLF_FAIL)) && len) {
+	if (((conv_flags & CONV_EOL_RNDTRP_WARN) ||
+	     ((conv_flags & CONV_EOL_RNDTRP_DIE) && len))) {
 		struct text_stat new_stats;
 		memcpy(&new_stats, &stats, sizeof(new_stats));
 		/* simulate "git add" */
@@ -316,7 +316,7 @@ static int crlf_to_git(const struct index_state *istate,
 			new_stats.crlf += new_stats.lonelf;
 			new_stats.lonelf = 0;
 		}
-		check_safe_crlf(path, crlf_action, &stats, &new_stats, checksafe);
+		check_global_conv_flags_eol(path, crlf_action, &stats, &new_stats, conv_flags);
 	}
 	if (!convert_crlf_into_lf)
 		return 0;
@@ -1129,7 +1129,7 @@ const char *get_convert_attr_ascii(const char *path)
 
 int convert_to_git(const struct index_state *istate,
 		   const char *path, const char *src, size_t len,
-                   struct strbuf *dst, enum safe_crlf checksafe)
+		   struct strbuf *dst, int conv_flags)
 {
 	int ret = 0;
 	struct conv_attrs ca;
@@ -1144,8 +1144,8 @@ int convert_to_git(const struct index_state *istate,
 		src = dst->buf;
 		len = dst->len;
 	}
-	if (checksafe != SAFE_CRLF_KEEP_CRLF) {
-		ret |= crlf_to_git(istate, path, src, len, dst, ca.crlf_action, checksafe);
+	if (!(conv_flags & CONV_EOL_KEEP_CRLF)) {
+		ret |= crlf_to_git(istate, path, src, len, dst, ca.crlf_action, conv_flags);
 		if (ret && dst) {
 			src = dst->buf;
 			len = dst->len;
@@ -1156,7 +1156,7 @@ int convert_to_git(const struct index_state *istate,
 
 void convert_to_git_filter_fd(const struct index_state *istate,
 			      const char *path, int fd, struct strbuf *dst,
-			      enum safe_crlf checksafe)
+			      int conv_flags)
 {
 	struct conv_attrs ca;
 	convert_attrs(&ca, path);
@@ -1167,7 +1167,7 @@ void convert_to_git_filter_fd(const struct index_state *istate,
 	if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN, NULL))
 		die("%s: clean filter '%s' failed", path, ca.drv->name);
 
-	crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, checksafe);
+	crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, conv_flags);
 	ident_to_git(path, dst->buf, dst->len, dst, ca.ident);
 }
 
@@ -1226,7 +1226,7 @@ int renormalize_buffer(const struct index_state *istate, const char *path,
 		src = dst->buf;
 		len = dst->len;
 	}
-	return ret | convert_to_git(istate, path, src, len, dst, SAFE_CRLF_RENORMALIZE);
+	return ret | convert_to_git(istate, path, src, len, dst, CONV_EOL_RENORMALIZE);
 }
 
 /*****************************************************************
diff --git a/convert.h b/convert.h
index 4f2da225a..65ab3e516 100644
--- a/convert.h
+++ b/convert.h
@@ -8,15 +8,12 @@
 
 struct index_state;
 
-enum safe_crlf {
-	SAFE_CRLF_FALSE = 0,
-	SAFE_CRLF_FAIL = 1,
-	SAFE_CRLF_WARN = 2,
-	SAFE_CRLF_RENORMALIZE = 3,
-	SAFE_CRLF_KEEP_CRLF = 4
-};
+#define CONV_EOL_RNDTRP_DIE   (1<<0) /* Die if CRLF to LF to CRLF is different */
+#define CONV_EOL_RNDTRP_WARN  (1<<1) /* Warn if CRLF to LF to CRLF is different */
+#define CONV_EOL_RENORMALIZE  (1<<2) /* Convert CRLF to LF */
+#define CONV_EOL_KEEP_CRLF    (1<<3) /* Keep CRLF line endings as is */
 
-extern enum safe_crlf safe_crlf;
+extern int global_conv_flags_eol;
 
 enum auto_crlf {
 	AUTO_CRLF_FALSE = 0,
@@ -66,7 +63,7 @@ extern const char *get_convert_attr_ascii(const char *path);
 /* returns 1 if *dst was used */
 extern int convert_to_git(const struct index_state *istate,
 			  const char *path, const char *src, size_t len,
-			  struct strbuf *dst, enum safe_crlf checksafe);
+			  struct strbuf *dst, int conv_flags);
 extern int convert_to_working_tree(const char *path, const char *src,
 				   size_t len, struct strbuf *dst);
 extern int async_convert_to_working_tree(const char *path, const char *src,
@@ -85,7 +82,7 @@ static inline int would_convert_to_git(const struct index_state *istate,
 extern void convert_to_git_filter_fd(const struct index_state *istate,
 				     const char *path, int fd,
 				     struct strbuf *dst,
-				     enum safe_crlf checksafe);
+				     int conv_flags);
 extern int would_convert_to_git_filter_fd(const char *path);
 
 /*****************************************************************
diff --git a/diff.c b/diff.c
index fb22b19f0..35cca04f2 100644
--- a/diff.c
+++ b/diff.c
@@ -3520,13 +3520,13 @@ int diff_populate_filespec(struct diff_filespec *s, unsigned int flags)
 {
 	int size_only = flags & CHECK_SIZE_ONLY;
 	int err = 0;
+	int conv_flags = global_conv_flags_eol;
 	/*
 	 * demote FAIL to WARN to allow inspecting the situation
 	 * instead of refusing.
 	 */
-	enum safe_crlf crlf_warn = (safe_crlf == SAFE_CRLF_FAIL
-				    ? SAFE_CRLF_WARN
-				    : safe_crlf);
+	if (conv_flags & CONV_EOL_RNDTRP_DIE)
+		conv_flags = CONV_EOL_RNDTRP_WARN;
 
 	if (!DIFF_FILE_VALID(s))
 		die("internal error: asking to populate invalid file.");
@@ -3603,7 +3603,7 @@ int diff_populate_filespec(struct diff_filespec *s, unsigned int flags)
 		/*
 		 * Convert from working tree format to canonical git format
 		 */
-		if (convert_to_git(&the_index, s->path, s->data, s->size, &buf, crlf_warn)) {
+		if (convert_to_git(&the_index, s->path, s->data, s->size, &buf, conv_flags)) {
 			size_t size = 0;
 			munmap(s->data, s->size);
 			s->should_munmap = 0;
diff --git a/environment.c b/environment.c
index 63ac38a46..10a32c20a 100644
--- a/environment.c
+++ b/environment.c
@@ -49,7 +49,7 @@ enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
 int check_replace_refs = 1;
 char *git_replace_ref_base;
 enum eol core_eol = EOL_UNSET;
-enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
+int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
 unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
 enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
 enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
diff --git a/sha1_file.c b/sha1_file.c
index 3da70ac65..6bc7c6ada 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -133,14 +133,14 @@ static struct cached_object *find_cached_object(const unsigned char *sha1)
 }
 
 
-static enum safe_crlf get_safe_crlf(unsigned flags)
+static int get_conv_flags(unsigned flags)
 {
 	if (flags & HASH_RENORMALIZE)
-		return SAFE_CRLF_RENORMALIZE;
+		return CONV_EOL_RENORMALIZE;
 	else if (flags & HASH_WRITE_OBJECT)
-		return safe_crlf;
+	  return global_conv_flags_eol;
 	else
-		return SAFE_CRLF_FALSE;
+		return 0;
 }
 
 
@@ -1752,7 +1752,7 @@ static int index_mem(struct object_id *oid, void *buf, size_t size,
 	if ((type == OBJ_BLOB) && path) {
 		struct strbuf nbuf = STRBUF_INIT;
 		if (convert_to_git(&the_index, path, buf, size, &nbuf,
-				   get_safe_crlf(flags))) {
+				   get_conv_flags(flags))) {
 			buf = strbuf_detach(&nbuf, &size);
 			re_allocated = 1;
 		}
@@ -1786,7 +1786,7 @@ static int index_stream_convert_blob(struct object_id *oid, int fd,
 	assert(would_convert_to_git_filter_fd(path));
 
 	convert_to_git_filter_fd(&the_index, path, fd, &sbuf,
-				 get_safe_crlf(flags));
+				 get_conv_flags(flags));
 
 	if (write_object)
 		ret = write_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
-- 
2.16.0.rc0.2.g00e34bdac6.dirty


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-12 16:36 [PATCH] Fixed pervasive enumeration warning in convert.h randall.s.becker
2018-01-12 19:25 ` Junio C Hamano
2018-01-12 19:52   ` Randall S. Becker
2018-01-13 17:13     ` unused variable in hashmap.h [was: Re: [PATCH] Fixed pervasive enumeration warning in convert.h.] René Scharfe
2018-01-13 17:30       ` Randall S. Becker
2018-01-13 22:49   ` [PATCH v1 1/1] convert_to_git(): safe_crlf/checksafe becomes int conv_flags tboegi

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox