Show 20 quoted lines
> 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).