Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/tset/map.c
Context not available. | |||||
mapp->porttype = strdup(port); | mapp->porttype = strdup(port); | ||||
} | } | ||||
#ifdef MAPDEBUG | #ifdef MAPDEBUG | ||||
ed: I think assignments like these are typically not done in our codebase, especially not for local… | |||||
(void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY"); | (void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY"); | ||||
(void)printf("type: %s\n", mapp->type); | (void)printf("type: %s\n", mapp->type); | ||||
(void)printf("conditional: "); | (void)printf("conditional: "); | ||||
p = ""; | p = ""; | ||||
if (mapp->conditional & GT) { | if (mapp->conditional & GT) { | ||||
(void)printf("GT"); | (void)printf("GT"); | ||||
p = "/"; | p = "/"; | ||||
} | } | ||||
if (mapp->conditional & EQ) { | if (mapp->conditional & EQ) { | ||||
(void)printf("%sEQ", p); | (void)printf("%sEQ", p); | ||||
p = "/"; | p = "/"; | ||||
} | } | ||||
if (mapp->conditional & LT) | if (mapp->conditional & LT) | ||||
(void)printf("%sLT", p); | (void)printf("%sLT", p); | ||||
(void)printf("\nspeed: %d\n", mapp->speed); | (void)printf("\nspeed: %d\n", mapp->speed); | ||||
#endif | #endif | ||||
free(copy); | |||||
edUnsubmitted Not Done Inline ActionsCould you please move the call to free() closer to to the site where the variable is last used? Thanks! ed: Could you please move the call to `free()` closer to to the site where the variable is last… | |||||
} | } | ||||
/* | /* | ||||
* Return the type of terminal to use for a port of type 'type', as specified | * Return the type of terminal to use for a port of type 'type', as specified | ||||
* by the first applicable mapping in 'map'. If no mappings apply, return | * by the first applicable mapping in 'map'. If no mappings apply, return | ||||
* 'type'. | * 'type'. | ||||
*/ | */ | ||||
const char * | const char * | ||||
Show All 12 Lines |
I think assignments like these are typically not done in our codebase, especially not for local variables. Statements like these tend to have no effect, as the compiler will optimize it out anyway.
Apart from that, it looks good!