relax the limit on shortness of names a bit.

This commit is contained in:
Enno Rehling 2017-09-18 20:14:46 +02:00
parent f43ec9ee0f
commit 832ba5f948
2 changed files with 7 additions and 4 deletions

View File

@ -203,7 +203,7 @@ void free_ls(void *arg) {
static critbit_tree cb_equipments = { 0 }; static critbit_tree cb_equipments = { 0 };
#define EQNAMELEN 16 #define EQNAMELEN 24
typedef struct eq_entry { typedef struct eq_entry {
char key[EQNAMELEN]; char key[EQNAMELEN];
@ -240,7 +240,10 @@ equipment *get_equipment(const char *eqname)
{ {
const void *match; const void *match;
assert(strlen(eqname) < EQNAMELEN); if (strlen(eqname) >= EQNAMELEN) {
log_warning("equipment name is longer than %d bytes: %s", EQNAMELEN - 1, eqname);
return NULL;
}
match = cb_find_str(&cb_equipments, eqname); match = cb_find_str(&cb_equipments, eqname);
if (match) { if (match) {
@ -256,7 +259,7 @@ equipment *create_equipment(const char *eqname)
eq_entry ent; eq_entry ent;
if (len >= EQNAMELEN) { if (len >= EQNAMELEN) {
log_error("equipment names should be no longer than %d bytes: %s", EQNAMELEN-1, eqname); log_error("equipment name is longer than %d bytes: %s", EQNAMELEN-1, eqname);
len = EQNAMELEN-1; len = EQNAMELEN-1;
} }
memset(ent.key, 0, EQNAMELEN); memset(ent.key, 0, EQNAMELEN);

View File

@ -393,7 +393,7 @@ resource_type *rt_find(const char *name)
size_t len = strlen(name); size_t len = strlen(name);
if (len >= RTYPENAMELEN) { if (len >= RTYPENAMELEN) {
log_error("resource name is longer than %d bytes: %s", log_warning("resource name is longer than %d bytes: %s",
RTYPENAMELEN-1, name); RTYPENAMELEN-1, name);
return NULL; return NULL;
} }