Re: [PATCH v5 02/12] sha1-file: provide functions to look up hash algorithms

2018-11-13 Thread Ramsay Jones
On 14/11/2018 02:11, brian m. carlson wrote: > On Wed, Nov 14, 2018 at 12:11:07AM +, Ramsay Jones wrote: >> >> >> On 13/11/2018 18:42, Derrick Stolee wrote: >>> On 11/4/2018 6:44 PM, brian m. carlson wrote: +int hash_algo_by_name(const char *name) +{ +    int i; +    if

Re: [PATCH v5 02/12] sha1-file: provide functions to look up hash algorithms

2018-11-13 Thread brian m. carlson
On Wed, Nov 14, 2018 at 12:11:07AM +, Ramsay Jones wrote: > > > On 13/11/2018 18:42, Derrick Stolee wrote: > > On 11/4/2018 6:44 PM, brian m. carlson wrote: > >> +int hash_algo_by_name(const char *name) > >> +{ > >> +    int i; > >> +    if (!name) > >> +    return GIT_HASH_UNKNOWN; > >>

Re: [PATCH v5 02/12] sha1-file: provide functions to look up hash algorithms

2018-11-13 Thread brian m. carlson
On Tue, Nov 13, 2018 at 07:45:41PM +0100, Duy Nguyen wrote: > On Tue, Nov 13, 2018 at 7:42 PM Derrick Stolee wrote: > > > > On 11/4/2018 6:44 PM, brian m. carlson wrote: > > > +int hash_algo_by_name(const char *name) > > > +{ > > > + int i; > > > + if (!name) > > > + return

Re: [PATCH v5 02/12] sha1-file: provide functions to look up hash algorithms

2018-11-13 Thread Jeff King
On Wed, Nov 14, 2018 at 12:42:45AM +, Ramsay Jones wrote: > BTW, if you were puzzling over the 3rd symbol from sha1-file.o > (which I wasn't counting in the 4 symbols above! ;-) ), then I > believe that is because Jeff's commit 3a2e08245c ("object-store: > provide helpers for

Re: [PATCH v5 02/12] sha1-file: provide functions to look up hash algorithms

2018-11-13 Thread Ramsay Jones
On 14/11/2018 00:11, Ramsay Jones wrote: > > > On 13/11/2018 18:42, Derrick Stolee wrote: >> On 11/4/2018 6:44 PM, brian m. carlson wrote: >>> +int hash_algo_by_name(const char *name) >>> +{ >>> +    int i; >>> +    if (!name) >>> +    return GIT_HASH_UNKNOWN; >>> +    for (i = 1; i <

Re: [PATCH v5 02/12] sha1-file: provide functions to look up hash algorithms

2018-11-13 Thread Ramsay Jones
On 13/11/2018 18:42, Derrick Stolee wrote: > On 11/4/2018 6:44 PM, brian m. carlson wrote: >> +int hash_algo_by_name(const char *name) >> +{ >> +    int i; >> +    if (!name) >> +    return GIT_HASH_UNKNOWN; >> +    for (i = 1; i < GIT_HASH_NALGOS; i++) >> +    if (!strcmp(name,

Re: [PATCH v5 02/12] sha1-file: provide functions to look up hash algorithms

2018-11-13 Thread Duy Nguyen
On Tue, Nov 13, 2018 at 7:42 PM Derrick Stolee wrote: > > On 11/4/2018 6:44 PM, brian m. carlson wrote: > > +int hash_algo_by_name(const char *name) > > +{ > > + int i; > > + if (!name) > > + return GIT_HASH_UNKNOWN; > > + for (i = 1; i < GIT_HASH_NALGOS; i++) > > +

Re: [PATCH v5 02/12] sha1-file: provide functions to look up hash algorithms

2018-11-13 Thread Derrick Stolee
On 11/4/2018 6:44 PM, brian m. carlson wrote: +int hash_algo_by_name(const char *name) +{ + int i; + if (!name) + return GIT_HASH_UNKNOWN; + for (i = 1; i < GIT_HASH_NALGOS; i++) + if (!strcmp(name, hash_algos[i].name)) + return

[PATCH v5 02/12] sha1-file: provide functions to look up hash algorithms

2018-11-04 Thread brian m. carlson
There are several ways we might refer to a hash algorithm: by name, such as in the config file; by format ID, such as in a pack; or internally, by a pointer to the hash_algos array. Provide functions to look up hash algorithms based on these various forms and return the internal constant used for