git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] config: add _cb suffix to callback functions
@ 2013-08-27  8:12 Natanael Copa
  2013-08-27 14:54 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Natanael Copa @ 2013-08-27  8:12 UTC (permalink / raw)
  To: git; +Cc: Natanael Copa

Commit 4d8dd1494e9f3af2e9738edaca40ada096f7bf10 introduced a build
regression on uClibc which defines fgetc as macro. To work around that
we add a _cb suffix to the callback functions.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
 config.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/config.c b/config.c
index e13a7b6..aa80078 100644
--- a/config.c
+++ b/config.c
@@ -27,9 +27,9 @@ struct config_source {
 	struct strbuf value;
 	struct strbuf var;
 
-	int (*fgetc)(struct config_source *c);
-	int (*ungetc)(int c, struct config_source *conf);
-	long (*ftell)(struct config_source *c);
+	int (*fgetc_cb)(struct config_source *c);
+	int (*ungetc_cb)(int c, struct config_source *conf);
+	long (*ftell_cb)(struct config_source *c);
 };
 
 static struct config_source *cf;
@@ -217,13 +217,13 @@ int git_config_from_parameters(config_fn_t fn, void *data)
 
 static int get_next_char(void)
 {
-	int c = cf->fgetc(cf);
+	int c = cf->fgetc_cb(cf);
 
 	if (c == '\r') {
 		/* DOS like systems */
-		c = cf->fgetc(cf);
+		c = cf->fgetc_cb(cf);
 		if (c != '\n') {
-			cf->ungetc(c, cf);
+			cf->ungetc_cb(c, cf);
 			c = '\r';
 		}
 	}
@@ -992,9 +992,9 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)
 		top.u.file = f;
 		top.name = filename;
 		top.die_on_error = 1;
-		top.fgetc = config_file_fgetc;
-		top.ungetc = config_file_ungetc;
-		top.ftell = config_file_ftell;
+		top.fgetc_cb = config_file_fgetc;
+		top.ungetc_cb = config_file_ungetc;
+		top.ftell_cb = config_file_ftell;
 
 		ret = do_config_from(&top, fn, data);
 
@@ -1013,9 +1013,9 @@ int git_config_from_buf(config_fn_t fn, const char *name, const char *buf,
 	top.u.buf.pos = 0;
 	top.name = name;
 	top.die_on_error = 0;
-	top.fgetc = config_buf_fgetc;
-	top.ungetc = config_buf_ungetc;
-	top.ftell = config_buf_ftell;
+	top.fgetc_cb = config_buf_fgetc;
+	top.ungetc_cb = config_buf_ungetc;
+	top.ftell_cb = config_buf_ftell;
 
 	return do_config_from(&top, fn, data);
 }
@@ -1196,7 +1196,7 @@ static int store_aux(const char *key, const char *value, void *cb)
 				return 1;
 			}
 
-			store.offset[store.seen] = cf->ftell(cf);
+			store.offset[store.seen] = cf->ftell_cb(cf);
 			store.seen++;
 		}
 		break;
@@ -1223,19 +1223,19 @@ static int store_aux(const char *key, const char *value, void *cb)
 		 * Do not increment matches: this is no match, but we
 		 * just made sure we are in the desired section.
 		 */
-		store.offset[store.seen] = cf->ftell(cf);
+		store.offset[store.seen] = cf->ftell_cb(cf);
 		/* fallthru */
 	case SECTION_END_SEEN:
 	case START:
 		if (matches(key, value)) {
-			store.offset[store.seen] = cf->ftell(cf);
+			store.offset[store.seen] = cf->ftell_cb(cf);
 			store.state = KEY_SEEN;
 			store.seen++;
 		} else {
 			if (strrchr(key, '.') - key == store.baselen &&
 			      !strncmp(key, store.key, store.baselen)) {
 					store.state = SECTION_SEEN;
-					store.offset[store.seen] = cf->ftell(cf);
+					store.offset[store.seen] = cf->ftell_cb(cf);
 			}
 		}
 	}
-- 
1.8.3.4

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

* Re: [PATCH] config: add _cb suffix to callback functions
  2013-08-27  8:12 [PATCH] config: add _cb suffix to callback functions Natanael Copa
@ 2013-08-27 14:54 ` Junio C Hamano
  2013-08-27 19:47   ` Eric Sunshine
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2013-08-27 14:54 UTC (permalink / raw)
  To: Natanael Copa; +Cc: git

Natanael Copa <ncopa@alpinelinux.org> writes:

> Commit 4d8dd1494e9f3af2e9738edaca40ada096f7bf10 introduced a build
> regression on uClibc which defines fgetc as macro. To work around that
> we add a _cb suffix to the callback functions.
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---

Thanks; I think Peff already fixed this yesterday.

Just for future reference, a looong commit object name like this

> Commit 4d8dd1494e9f3af2e9738edaca40ada096f7bf10 introduced a build

is not very friendly to human readers in a log message; it does not
help tickle their memory.

    4d8dd149 (config: make parsing stack struct independent from
    actual data source, 2013-07-12) introduced...

may be a way to phrase it in a more useful way.

>  config.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/config.c b/config.c
> index e13a7b6..aa80078 100644
> --- a/config.c
> +++ b/config.c
> @@ -27,9 +27,9 @@ struct config_source {
>  	struct strbuf value;
>  	struct strbuf var;
>  
> -	int (*fgetc)(struct config_source *c);
> -	int (*ungetc)(int c, struct config_source *conf);
> -	long (*ftell)(struct config_source *c);
> +	int (*fgetc_cb)(struct config_source *c);
> +	int (*ungetc_cb)(int c, struct config_source *conf);
> +	long (*ftell_cb)(struct config_source *c);
>  };
>  
>  static struct config_source *cf;
> @@ -217,13 +217,13 @@ int git_config_from_parameters(config_fn_t fn, void *data)
>  
>  static int get_next_char(void)
>  {
> -	int c = cf->fgetc(cf);
> +	int c = cf->fgetc_cb(cf);
>  
>  	if (c == '\r') {
>  		/* DOS like systems */
> -		c = cf->fgetc(cf);
> +		c = cf->fgetc_cb(cf);
>  		if (c != '\n') {
> -			cf->ungetc(c, cf);
> +			cf->ungetc_cb(c, cf);
>  			c = '\r';
>  		}
>  	}
> @@ -992,9 +992,9 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)
>  		top.u.file = f;
>  		top.name = filename;
>  		top.die_on_error = 1;
> -		top.fgetc = config_file_fgetc;
> -		top.ungetc = config_file_ungetc;
> -		top.ftell = config_file_ftell;
> +		top.fgetc_cb = config_file_fgetc;
> +		top.ungetc_cb = config_file_ungetc;
> +		top.ftell_cb = config_file_ftell;
>  
>  		ret = do_config_from(&top, fn, data);
>  
> @@ -1013,9 +1013,9 @@ int git_config_from_buf(config_fn_t fn, const char *name, const char *buf,
>  	top.u.buf.pos = 0;
>  	top.name = name;
>  	top.die_on_error = 0;
> -	top.fgetc = config_buf_fgetc;
> -	top.ungetc = config_buf_ungetc;
> -	top.ftell = config_buf_ftell;
> +	top.fgetc_cb = config_buf_fgetc;
> +	top.ungetc_cb = config_buf_ungetc;
> +	top.ftell_cb = config_buf_ftell;
>  
>  	return do_config_from(&top, fn, data);
>  }
> @@ -1196,7 +1196,7 @@ static int store_aux(const char *key, const char *value, void *cb)
>  				return 1;
>  			}
>  
> -			store.offset[store.seen] = cf->ftell(cf);
> +			store.offset[store.seen] = cf->ftell_cb(cf);
>  			store.seen++;
>  		}
>  		break;
> @@ -1223,19 +1223,19 @@ static int store_aux(const char *key, const char *value, void *cb)
>  		 * Do not increment matches: this is no match, but we
>  		 * just made sure we are in the desired section.
>  		 */
> -		store.offset[store.seen] = cf->ftell(cf);
> +		store.offset[store.seen] = cf->ftell_cb(cf);
>  		/* fallthru */
>  	case SECTION_END_SEEN:
>  	case START:
>  		if (matches(key, value)) {
> -			store.offset[store.seen] = cf->ftell(cf);
> +			store.offset[store.seen] = cf->ftell_cb(cf);
>  			store.state = KEY_SEEN;
>  			store.seen++;
>  		} else {
>  			if (strrchr(key, '.') - key == store.baselen &&
>  			      !strncmp(key, store.key, store.baselen)) {
>  					store.state = SECTION_SEEN;
> -					store.offset[store.seen] = cf->ftell(cf);
> +					store.offset[store.seen] = cf->ftell_cb(cf);
>  			}
>  		}
>  	}

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

* Re: [PATCH] config: add _cb suffix to callback functions
  2013-08-27 14:54 ` Junio C Hamano
@ 2013-08-27 19:47   ` Eric Sunshine
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sunshine @ 2013-08-27 19:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Natanael Copa, Git List

On Tue, Aug 27, 2013 at 10:54 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Natanael Copa <ncopa@alpinelinux.org> writes:
>
>> Commit 4d8dd1494e9f3af2e9738edaca40ada096f7bf10 introduced a build
>> regression on uClibc which defines fgetc as macro. To work around that
>> we add a _cb suffix to the callback functions.
>>
>> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
>> ---
>
> Thanks; I think Peff already fixed this yesterday.

For reference: http://thread.gmane.org/gmane.comp.version-control.git/233021/focus=233036

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

end of thread, other threads:[~2013-08-27 19:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-27  8:12 [PATCH] config: add _cb suffix to callback functions Natanael Copa
2013-08-27 14:54 ` Junio C Hamano
2013-08-27 19:47   ` Eric Sunshine

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).