Jeff King <p...@peff.net> writes:

> I'd be surprised if it appreciably speeds things up, but I guess it is
> not too complicated to do.
>
>> +static struct {
>> +    const char *str;
>> +    int len;
>> +} object_type_name[] = {
>> +    { NULL, 0 },      /* OBJ_NONE = 0 */
>> +    { "commit", 6 },  /* OBJ_COMMIT = 1 */
>> +    { "tree", 4 },    /* OBJ_TREE = 2 */
>> +    { "blob", 4 },    /* OBJ_BLOB = 3 */
>> +    { "tag", 3 },     /* OBJ_TAG = 4 */
>>  };
>
> I had envisioned a macro like:
>
>   #define SIZED_STRING(x) { (x), (sizeof(x) - 1) }
>
> though perhaps that is overkill for such a short list (that we don't
> even expect to change).

Sounds good (either way ;-)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to