Commit e70b123a authored by Michael Beck's avatar Michael Beck
Browse files

do not access the ld_name field of entities if it's not set, else

a default name is generated

[r6876]
parent 26c150fa
......@@ -14,6 +14,8 @@
# include "config.h"
#endif
#ifdef WITH_LIBCORE
#include "bitset.h"
#include <ctype.h>
......@@ -84,6 +86,15 @@ static int firm_emit_dbg(lc_appendable_t *app,
return lc_arg_append(app, occ, buf, strlen(buf));
}
/**
* Beware: do not set the entity ld_name
*/
static const char *get_entity_ld_name_ex(entity *ent) {
if (ent->ld_name)
return get_entity_ld_name(ent);
return get_entity_name(ent);
}
/**
* emit a Firm object
*/
......@@ -114,7 +125,7 @@ static int firm_emit(lc_appendable_t *app,
break;
case k_entity:
snprintf(buf, sizeof(buf), "%s%s", A("ent"),
isupper(occ->conversion) ? get_entity_ld_name(X): get_entity_name(X));
isupper(occ->conversion) ? get_entity_ld_name_ex(X): get_entity_name(X));
snprintf(add, sizeof(add), "[%ld]", get_entity_nr(X));
break;
case k_type:
......@@ -280,3 +291,5 @@ lc_arg_env_t *firm_get_arg_env(void)
return env;
}
#endif /* WITH_LIBCORE */
......@@ -252,6 +252,15 @@ static void dump_with_settings(const appender_t *app, void *object, size_t limit
app->append_str(object, limit, str);
}
/**
* Beware: do not set the entity ld_name
*/
static const char *get_entity_ld_name_ex(entity *ent) {
if (ent->ld_name)
return get_entity_ld_name(ent);
return get_entity_name(ent);
}
/**
* emit a Firm object. Backported from irargs.
*/
......@@ -280,7 +289,7 @@ static void firm_emit(char *buf, int buflen, char conversion,
break;
case k_entity:
snprintf(buf, buflen, "%s%s", A("ent"),
isupper(conversion) ? get_entity_ld_name(X): get_entity_name(X));
isupper(conversion) ? get_entity_ld_name_ex(X): get_entity_name(X));
snprintf(add, sizeof(add), "[%ld]", get_entity_nr(X));
break;
case k_type:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment