* OTHER DEALINGS IN THE SOFTWARE.
*/
-#define _GNU_SOURCE // for asprintf
#include "rnndec.h"
#include <assert.h>
#include <stdio.h>
return res;
}
-int rnndec_varadd(struct rnndeccontext *ctx, char *varset, char *variant) {
+int rnndec_varadd(struct rnndeccontext *ctx, char *varset, const char *variant) {
struct rnnenum *en = rnn_findenum(ctx->db, varset);
if (!en) {
fprintf (stderr, "Enum %s doesn't exist in database!\n", varset);
struct rnnbitfield **bitfields;
int bitfieldsnum;
char *tmp;
+ const char *ctmp;
uint64_t mask, value_orig;
if (!ti)
goto failhex;
valsnum = ti->valsnum;
goto doenum;
doenum:
- tmp = rnndec_decode_enum_val(ctx, vals, valsnum, value);
- if (tmp) {
- asprintf (&res, "%s%s%s", ctx->colors->eval, tmp, ctx->colors->reset);
+ ctmp = rnndec_decode_enum_val(ctx, vals, valsnum, value);
+ if (ctmp) {
+ asprintf (&res, "%s%s%s", ctx->colors->eval, ctmp, ctx->colors->reset);
if (ti->addvariant) {
- rnndec_varadd(ctx, ti->eenum->name, tmp);
+ rnndec_varadd(ctx, ti->eenum->name, ctmp);
}
break;
}
}
static char *appendidx (struct rnndeccontext *ctx, char *name, uint64_t idx, struct rnnenum *index) {
- char *res, *index_name = NULL;
+ char *res;
+ const char *index_name = NULL;
if (index)
index_name = rnndec_decode_enum_val(ctx, index->vals, index->valsnum, idx);
};
struct rnndeccontext *rnndec_newcontext(struct rnndb *db);
-int rnndec_varadd(struct rnndeccontext *ctx, char *varset, char *variant);
+int rnndec_varadd(struct rnndeccontext *ctx, char *varset, const char *variant);
int rnndec_varmatch(struct rnndeccontext *ctx, struct rnnvarinfo *vi);
char *rnndec_decode_enum(struct rnndeccontext *ctx, const char *enumname, uint64_t enumval);
char *rnndec_decodeval(struct rnndeccontext *ctx, struct rnntypeinfo *ti, uint64_t value);