{"thread":{"id":"34775","subject":"[PATCH] config: add _cb suffix to callback functions","startedAt":"2013-08-27T08:12:16Z","lastAt":"2013-08-27T19:47:08Z","messageCount":3,"participants":["Natanael Copa","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"225983","messageId":"1377591136-10680-1-git-send-email-ncopa@alpinelinux.org","threadId":"34775","inReplyTo":null,"subject":"[PATCH] config: add _cb suffix to callback functions","fromName":"Natanael Copa","fromEmail":"ncopa@alpinelinux.org","sentAt":"2013-08-27T08:12:16Z","receivedAt":"2013-08-27T08:12:16Z","isPatch":true,"sender":{"key":"ncopa@alpinelinux.org","avatar":null},"body":"Commit 4d8dd1494e9f3af2e9738edaca40ada096f7bf10 introduced a build\nregression on uClibc which defines fgetc as macro. To work around that\nwe add a _cb suffix to the callback functions.\n\nSigned-off-by: Natanael Copa <ncopa@alpinelinux.org>\n---\n config.c | 32 ++++++++++++++++----------------\n 1 file changed, 16 insertions(+), 16 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex e13a7b6..aa80078 100644\n--- a/config.c\n+++ b/config.c\n@@ -27,9 +27,9 @@ struct config_source {\n \tstruct strbuf value;\n \tstruct strbuf var;\n \n-\tint (*fgetc)(struct config_source *c);\n-\tint (*ungetc)(int c, struct config_source *conf);\n-\tlong (*ftell)(struct config_source *c);\n+\tint (*fgetc_cb)(struct config_source *c);\n+\tint (*ungetc_cb)(int c, struct config_source *conf);\n+\tlong (*ftell_cb)(struct config_source *c);\n };\n \n static struct config_source *cf;\n@@ -217,13 +217,13 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n \n static int get_next_char(void)\n {\n-\tint c = cf->fgetc(cf);\n+\tint c = cf->fgetc_cb(cf);\n \n \tif (c == '\\r') {\n \t\t/* DOS like systems */\n-\t\tc = cf->fgetc(cf);\n+\t\tc = cf->fgetc_cb(cf);\n \t\tif (c != '\\n') {\n-\t\t\tcf->ungetc(c, cf);\n+\t\t\tcf->ungetc_cb(c, cf);\n \t\t\tc = '\\r';\n \t\t}\n \t}\n@@ -992,9 +992,9 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)\n \t\ttop.u.file = f;\n \t\ttop.name = filename;\n \t\ttop.die_on_error = 1;\n-\t\ttop.fgetc = config_file_fgetc;\n-\t\ttop.ungetc = config_file_ungetc;\n-\t\ttop.ftell = config_file_ftell;\n+\t\ttop.fgetc_cb = config_file_fgetc;\n+\t\ttop.ungetc_cb = config_file_ungetc;\n+\t\ttop.ftell_cb = config_file_ftell;\n \n \t\tret = do_config_from(&top, fn, data);\n \n@@ -1013,9 +1013,9 @@ int git_config_from_buf(config_fn_t fn, const char *name, const char *buf,\n \ttop.u.buf.pos = 0;\n \ttop.name = name;\n \ttop.die_on_error = 0;\n-\ttop.fgetc = config_buf_fgetc;\n-\ttop.ungetc = config_buf_ungetc;\n-\ttop.ftell = config_buf_ftell;\n+\ttop.fgetc_cb = config_buf_fgetc;\n+\ttop.ungetc_cb = config_buf_ungetc;\n+\ttop.ftell_cb = config_buf_ftell;\n \n \treturn do_config_from(&top, fn, data);\n }\n@@ -1196,7 +1196,7 @@ static int store_aux(const char *key, const char *value, void *cb)\n \t\t\t\treturn 1;\n \t\t\t}\n \n-\t\t\tstore.offset[store.seen] = cf->ftell(cf);\n+\t\t\tstore.offset[store.seen] = cf->ftell_cb(cf);\n \t\t\tstore.seen++;\n \t\t}\n \t\tbreak;\n@@ -1223,19 +1223,19 @@ static int store_aux(const char *key, const char *value, void *cb)\n \t\t * Do not increment matches: this is no match, but we\n \t\t * just made sure we are in the desired section.\n \t\t */\n-\t\tstore.offset[store.seen] = cf->ftell(cf);\n+\t\tstore.offset[store.seen] = cf->ftell_cb(cf);\n \t\t/* fallthru */\n \tcase SECTION_END_SEEN:\n \tcase START:\n \t\tif (matches(key, value)) {\n-\t\t\tstore.offset[store.seen] = cf->ftell(cf);\n+\t\t\tstore.offset[store.seen] = cf->ftell_cb(cf);\n \t\t\tstore.state = KEY_SEEN;\n \t\t\tstore.seen++;\n \t\t} else {\n \t\t\tif (strrchr(key, '.') - key == store.baselen &&\n \t\t\t      !strncmp(key, store.key, store.baselen)) {\n \t\t\t\t\tstore.state = SECTION_SEEN;\n-\t\t\t\t\tstore.offset[store.seen] = cf->ftell(cf);\n+\t\t\t\t\tstore.offset[store.seen] = cf->ftell_cb(cf);\n \t\t\t}\n \t\t}\n \t}\n-- \n1.8.3.4\n"},{"id":"225998","messageId":"xmqqmwo3falr.fsf@gitster.dls.corp.google.com","threadId":"34775","inReplyTo":"1377591136-10680-1-git-send-email-ncopa@alpinelinux.org","subject":"Re: [PATCH] config: add _cb suffix to callback functions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-27T14:54:08Z","receivedAt":"2013-08-27T14:54:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Natanael Copa <ncopa@alpinelinux.org> writes:\n\n> Commit 4d8dd1494e9f3af2e9738edaca40ada096f7bf10 introduced a build\n> regression on uClibc which defines fgetc as macro. To work around that\n> we add a _cb suffix to the callback functions.\n>\n> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>\n> ---\n\nThanks; I think Peff already fixed this yesterday.\n\nJust for future reference, a looong commit object name like this\n\n> Commit 4d8dd1494e9f3af2e9738edaca40ada096f7bf10 introduced a build\n\nis not very friendly to human readers in a log message; it does not\nhelp tickle their memory.\n\n    4d8dd149 (config: make parsing stack struct independent from\n    actual data source, 2013-07-12) introduced...\n\nmay be a way to phrase it in a more useful way.\n\n>  config.c | 32 ++++++++++++++++----------------\n>  1 file changed, 16 insertions(+), 16 deletions(-)\n>\n> diff --git a/config.c b/config.c\n> index e13a7b6..aa80078 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -27,9 +27,9 @@ struct config_source {\n>  \tstruct strbuf value;\n>  \tstruct strbuf var;\n>  \n> -\tint (*fgetc)(struct config_source *c);\n> -\tint (*ungetc)(int c, struct config_source *conf);\n> -\tlong (*ftell)(struct config_source *c);\n> +\tint (*fgetc_cb)(struct config_source *c);\n> +\tint (*ungetc_cb)(int c, struct config_source *conf);\n> +\tlong (*ftell_cb)(struct config_source *c);\n>  };\n>  \n>  static struct config_source *cf;\n> @@ -217,13 +217,13 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n>  \n>  static int get_next_char(void)\n>  {\n> -\tint c = cf->fgetc(cf);\n> +\tint c = cf->fgetc_cb(cf);\n>  \n>  \tif (c == '\\r') {\n>  \t\t/* DOS like systems */\n> -\t\tc = cf->fgetc(cf);\n> +\t\tc = cf->fgetc_cb(cf);\n>  \t\tif (c != '\\n') {\n> -\t\t\tcf->ungetc(c, cf);\n> +\t\t\tcf->ungetc_cb(c, cf);\n>  \t\t\tc = '\\r';\n>  \t\t}\n>  \t}\n> @@ -992,9 +992,9 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)\n>  \t\ttop.u.file = f;\n>  \t\ttop.name = filename;\n>  \t\ttop.die_on_error = 1;\n> -\t\ttop.fgetc = config_file_fgetc;\n> -\t\ttop.ungetc = config_file_ungetc;\n> -\t\ttop.ftell = config_file_ftell;\n> +\t\ttop.fgetc_cb = config_file_fgetc;\n> +\t\ttop.ungetc_cb = config_file_ungetc;\n> +\t\ttop.ftell_cb = config_file_ftell;\n>  \n>  \t\tret = do_config_from(&top, fn, data);\n>  \n> @@ -1013,9 +1013,9 @@ int git_config_from_buf(config_fn_t fn, const char *name, const char *buf,\n>  \ttop.u.buf.pos = 0;\n>  \ttop.name = name;\n>  \ttop.die_on_error = 0;\n> -\ttop.fgetc = config_buf_fgetc;\n> -\ttop.ungetc = config_buf_ungetc;\n> -\ttop.ftell = config_buf_ftell;\n> +\ttop.fgetc_cb = config_buf_fgetc;\n> +\ttop.ungetc_cb = config_buf_ungetc;\n> +\ttop.ftell_cb = config_buf_ftell;\n>  \n>  \treturn do_config_from(&top, fn, data);\n>  }\n> @@ -1196,7 +1196,7 @@ static int store_aux(const char *key, const char *value, void *cb)\n>  \t\t\t\treturn 1;\n>  \t\t\t}\n>  \n> -\t\t\tstore.offset[store.seen] = cf->ftell(cf);\n> +\t\t\tstore.offset[store.seen] = cf->ftell_cb(cf);\n>  \t\t\tstore.seen++;\n>  \t\t}\n>  \t\tbreak;\n> @@ -1223,19 +1223,19 @@ static int store_aux(const char *key, const char *value, void *cb)\n>  \t\t * Do not increment matches: this is no match, but we\n>  \t\t * just made sure we are in the desired section.\n>  \t\t */\n> -\t\tstore.offset[store.seen] = cf->ftell(cf);\n> +\t\tstore.offset[store.seen] = cf->ftell_cb(cf);\n>  \t\t/* fallthru */\n>  \tcase SECTION_END_SEEN:\n>  \tcase START:\n>  \t\tif (matches(key, value)) {\n> -\t\t\tstore.offset[store.seen] = cf->ftell(cf);\n> +\t\t\tstore.offset[store.seen] = cf->ftell_cb(cf);\n>  \t\t\tstore.state = KEY_SEEN;\n>  \t\t\tstore.seen++;\n>  \t\t} else {\n>  \t\t\tif (strrchr(key, '.') - key == store.baselen &&\n>  \t\t\t      !strncmp(key, store.key, store.baselen)) {\n>  \t\t\t\t\tstore.state = SECTION_SEEN;\n> -\t\t\t\t\tstore.offset[store.seen] = cf->ftell(cf);\n> +\t\t\t\t\tstore.offset[store.seen] = cf->ftell_cb(cf);\n>  \t\t\t}\n>  \t\t}\n>  \t}\n"},{"id":"226050","messageId":"CAPig+cQ0a82N701PP0D-bgT7c_OGfZ1jdKeQxB9vaqqSDJyNBQ@mail.gmail.com","threadId":"34775","inReplyTo":"xmqqmwo3falr.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] config: add _cb suffix to callback functions","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-27T19:47:08Z","receivedAt":"2013-08-27T19:47:08Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Aug 27, 2013 at 10:54 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Natanael Copa <ncopa@alpinelinux.org> writes:\n>\n>> Commit 4d8dd1494e9f3af2e9738edaca40ada096f7bf10 introduced a build\n>> regression on uClibc which defines fgetc as macro. To work around that\n>> we add a _cb suffix to the callback functions.\n>>\n>> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>\n>> ---\n>\n> Thanks; I think Peff already fixed this yesterday.\n\nFor reference: http://thread.gmane.org/gmane.comp.version-control.git/233021/focus=233036\n"}]}