streq() compares strings for equality, it differs from strcmp() in that it can handle NULL pointers and that it short-circruits if a==b. returns 1 if the strings are equal (or both are NULL) and 0 when not. Signed-off-by: Christian Thaeter <ct@xxxxxxxxxx> --- Here comes a series of patches to reinit libgit with subsequent setup_git_directory() calls. So far, this only suffices for simple tasks like scanning a list of repositories (buiding the start page of a repository browser). There are still a lot of things not fixed yet (grep for '\tstatic', object & graft cache etc.). Nevertheless, it works for me so far. git-compat-util.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/git-compat-util.h b/git-compat-util.h index b6ef544..759e94c 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -424,4 +424,13 @@ static inline int strtol_i(char const *s, int base, int *result) return 0; } +static inline int streq(const char *a, const char* b) +{ + if (a == b) + return 1; + if (a && b) + return !strcmp(a, b); + return 0; +} + #endif -- 1.5.3.7 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html