MCPcopy Create free account
hub / github.com/git/git / interned_mode_string

Function interned_mode_string

attr.c:1245–1268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1243}
1244
1245static const char *interned_mode_string(unsigned int mode)
1246{
1247 static struct {
1248 unsigned int val;
1249 char str[7];
1250 } mode_string[] = {
1251 { .val = 0040000 },
1252 { .val = 0100644 },
1253 { .val = 0100755 },
1254 { .val = 0120000 },
1255 { .val = 0160000 },
1256 };
1257 int i;
1258
1259 for (i = 0; i < ARRAY_SIZE(mode_string); i++) {
1260 if (mode_string[i].val != mode)
1261 continue;
1262 if (!*mode_string[i].str)
1263 snprintf(mode_string[i].str, sizeof(mode_string[i].str),
1264 "%06o", mode);
1265 return mode_string[i].str;
1266 }
1267 BUG("Unsupported mode 0%o", mode);
1268}
1269
1270static const char *builtin_object_mode_attr(struct index_state *istate, const char *path)
1271{

Callers 1

builtin_object_mode_attrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected