{"thread":{"id":"29591","subject":"[PATCH 1/2] ctype.c only wants git-compat-util.h","startedAt":"2012-02-10T02:13:30Z","lastAt":"2012-02-10T05:04:53Z","messageCount":6,"participants":["Namhyung Kim","Junio C Hamano","김남형"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"184309","messageId":"1328840011-19028-1-git-send-email-namhyung.kim@lge.com","threadId":"29591","inReplyTo":null,"subject":"[PATCH 1/2] ctype.c only wants git-compat-util.h","fromName":"Namhyung Kim","fromEmail":"namhyung.kim@lge.com","sentAt":"2012-02-10T02:13:30Z","receivedAt":"2012-02-10T02:13:30Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"The implementation of sane ctype macros only depends on symbols in\ngit-compat-util.h not cache.h\n\nSigned-off-by: Namhyung Kim <namhyung.kim@lge.com>\n---\n ctype.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/ctype.c b/ctype.c\nindex b5d856f..af722f9 100644\n--- a/ctype.c\n+++ b/ctype.c\n@@ -3,7 +3,7 @@\n  *\n  * No surprises, and works with signed and unsigned chars.\n  */\n-#include \"cache.h\"\n+#include \"git-compat-util.h\"\n \n enum {\n \tS = GIT_SPACE,\n-- \n1.7.9\n"},{"id":"184310","messageId":"1328840011-19028-2-git-send-email-namhyung.kim@lge.com","threadId":"29591","inReplyTo":"1328840011-19028-1-git-send-email-namhyung.kim@lge.com","subject":"[PATCH 2/2] ctype: implement islower/isupper macro","fromName":"Namhyung Kim","fromEmail":"namhyung.kim@lge.com","sentAt":"2012-02-10T02:13:31Z","receivedAt":"2012-02-10T02:13:31Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"The git-compat-util.h provides various ctype macros but lacks those two\n(along with others). Add them.\n\nSigned-off-by: Namhyung Kim <namhyung.kim@lge.com>\n---\n git-compat-util.h |   15 +++++++++++++++\n 1 files changed, 15 insertions(+), 0 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 8f3972c..d3f8f17 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -463,6 +463,8 @@ static inline int has_extension(const char *filename, const char *ext)\n #undef isdigit\n #undef isalpha\n #undef isalnum\n+#undef islower\n+#undef isupper\n #undef tolower\n #undef toupper\n extern unsigned char sane_ctype[256];\n@@ -478,6 +480,8 @@ extern unsigned char sane_ctype[256];\n #define isdigit(x) sane_istest(x,GIT_DIGIT)\n #define isalpha(x) sane_istest(x,GIT_ALPHA)\n #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)\n+#define islower(x) sane_iscase(x, 1)\n+#define isupper(x) sane_iscase(x, 0)\n #define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL)\n #define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)\n #define tolower(x) sane_case((unsigned char)(x), 0x20)\n@@ -491,6 +495,17 @@ static inline int sane_case(int x, int high)\n \treturn x;\n }\n \n+static inline int sane_iscase(int x, int lower)\n+{\n+\tif (!sane_istest(x, GIT_ALPHA))\n+\t\treturn 0;\n+\n+\tif (lower)\n+\t\treturn (x & 0x20) != 0;\n+\telse\n+\t\treturn (x & 0x20) == 0;\n+}\n+\n static inline int strtoul_ui(char const *s, int base, unsigned int *result)\n {\n \tunsigned long ul;\n-- \n1.7.9\n"},{"id":"184312","messageId":"7vwr7vsa8j.fsf@alter.siamese.dyndns.org","threadId":"29591","inReplyTo":"1328840011-19028-2-git-send-email-namhyung.kim@lge.com","subject":"Re: [PATCH 2/2] ctype: implement islower/isupper macro","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-10T02:17:16Z","receivedAt":"2012-02-10T02:17:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Namhyung Kim <namhyung.kim@lge.com> writes:\n\n> The git-compat-util.h provides various ctype macros but lacks those two\n> (along with others). Add them.\n\nIsn't that because we do not use them ourselves? Uses in compat/ do not\ncount, and judging from the way it is used in compat/fnmatch/fnmatch.c,\nthe implementation of sane_iscase() might be overly protective.\n\nWhat problem are you trying to solve?\n"},{"id":"184315","messageId":"4F3481CD.5010303@lge.com","threadId":"29591","inReplyTo":"7vwr7vsa8j.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/2] ctype: implement islower/isupper macro","fromName":"김남형","fromEmail":"namhyung.kim@lge.com","sentAt":"2012-02-10T02:32:45Z","receivedAt":"2012-02-10T02:32:45Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"Hello,\n\n2012-02-10 11:17 AM, Junio C Hamano wrote:\n> Namhyung Kim <namhyung.kim@lge.com> writes:\n>\n>> The git-compat-util.h provides various ctype macros but lacks those two\n>> (along with others). Add them.\n>\n> Isn't that because we do not use them ourselves? Uses in compat/ do not\n> count, and judging from the way it is used in compat/fnmatch/fnmatch.c,\n> the implementation of sane_iscase() might be overly protective.\n>\n> What problem are you trying to solve?\n>\n\nThere's no problem. In fact, these patches come from perf as it uses a copy of \ngit code in this part. So I didn't check it's really needed for git too, but \njust hoped it'd be helpful someday. If you don't think it's worth applying I'm \nfine with dropping it.\n\nThanks,\nNamhyung\n"},{"id":"184319","messageId":"7vliobs5bh.fsf@alter.siamese.dyndns.org","threadId":"29591","inReplyTo":"4F3481CD.5010303@lge.com","subject":"Re: [PATCH 2/2] ctype: implement islower/isupper macro","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-10T04:03:30Z","receivedAt":"2012-02-10T04:03:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"김남형 <namhyung.kim@lge.com> writes:\n\n> 2012-02-10 11:17 AM, Junio C Hamano wrote:\n>> Namhyung Kim <namhyung.kim@lge.com> writes:\n>>\n>>> The git-compat-util.h provides various ctype macros but lacks those two\n>>> (along with others). Add them.\n>>\n>> Isn't that because we do not use them ourselves? Uses in compat/ do not\n>> count, and judging from the way it is used in compat/fnmatch/fnmatch.c,\n>> the implementation of sane_iscase() might be overly protective.\n>>\n>> What problem are you trying to solve?\n>\n> There's no problem. In fact, these patches come from perf as it uses a\n> copy of git code in this part.\n\nKim-ssi, the above is something I would have like to see in your first\nmessage.\n\n> If you don't\n> think it's worth applying I'm fine with dropping it.\n\nI never said these patches are worthless.\n\nI just was wondering what the motivation behind them were.  If you are\ninvolved in maintaining Perf, and if it wants to keep its own forked copy\nas close as ours, that is a good enough justification, as long as the\nadditions we do not use ourselves is still reasonably done.\n"},{"id":"184325","messageId":"4F34A575.3000700@lge.com","threadId":"29591","inReplyTo":"7vliobs5bh.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/2] ctype: implement islower/isupper macro","fromName":"Namhyung Kim","fromEmail":"namhyung.kim@lge.com","sentAt":"2012-02-10T05:04:53Z","receivedAt":"2012-02-10T05:04:53Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"2012-02-10 1:03 PM, Junio C Hamano wrote:\n> 김남형<namhyung.kim@lge.com>  writes:\n>\n>> 2012-02-10 11:17 AM, Junio C Hamano wrote:\n>>> Namhyung Kim<namhyung.kim@lge.com>  writes:\n>>>\n>>>> The git-compat-util.h provides various ctype macros but lacks those two\n>>>> (along with others). Add them.\n>>>\n>>> Isn't that because we do not use them ourselves? Uses in compat/ do not\n>>> count, and judging from the way it is used in compat/fnmatch/fnmatch.c,\n>>> the implementation of sane_iscase() might be overly protective.\n>>>\n>>> What problem are you trying to solve?\n>>\n>> There's no problem. In fact, these patches come from perf as it uses a\n>> copy of git code in this part.\n>\n> Kim-ssi, the above is something I would have like to see in your first\n> message.\n>\n>> If you don't\n>> think it's worth applying I'm fine with dropping it.\n>\n> I never said these patches are worthless.\n>\n> I just was wondering what the motivation behind them were.  If you are\n> involved in maintaining Perf, and if it wants to keep its own forked copy\n> as close as ours, that is a good enough justification, as long as the\n> additions we do not use ourselves is still reasonably done.\n>\n\nHamano-san, Thanks for your explanation. I'll try to write a better \ndescription for the future.\n\nThanks,\nNamhyung\n"}]}