From 16556c4b24e37a4d451b7a85a5d260c4ee9828cb Mon Sep 17 00:00:00 2001 From: "nicolas.zilio@hotmail.fr" <> Date: Tue, 15 Sep 2015 19:25:47 +0200 Subject: no more realloc in op enum --- pcilib/views.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'pcilib') diff --git a/pcilib/views.c b/pcilib/views.c index 83c5827..2011d86 100644 --- a/pcilib/views.c +++ b/pcilib/views.c @@ -139,7 +139,7 @@ int pcilib_read_view(pcilib_t *ctx, const char *bank, const char *regname, const for(j=0;ctx->register_ctx[i].views[j].name;j++){ if(!(strcasecmp("name",ctx->register_ctx[i].views[j].base_unit.name))){/*if we asked for the unit "name"*/ - err=ctx->register_ctx[i].views[j].op(ctx,ctx->register_ctx[i].views[j].parameters,value/*the command name*/,0,&temp_value,0,&(ctx->register_ctx[i].views[j])); + err=ctx->register_ctx[i].views[j].op(ctx,ctx->register_ctx[i].views[j].parameters,value/*the command name*/,0,&temp_value,value_size,NULL); if(err){ pcilib_error("can't read from the register with the enum view"); return PCILIB_ERROR_FAILED; @@ -198,7 +198,7 @@ int pcilib_write_view(pcilib_t *ctx, const char *bank, const char *regname, cons ok=1; break; }else if(!(strcasecmp(ctx->register_ctx[i].views[j].base_unit.name,(char*)unit))){/*in this case we asked for then name of the view in unit*/ - temp_value=*(pcilib_register_value_t*)value /*the value to put in the register*/; + //temp_value=*(pcilib_register_value_t*)value /*the value to put in the register*/; err=ctx->register_ctx[i].views[j].op(ctx,ctx->register_ctx[i].views[j].parameters, (char*)unit, 1, &temp_value,0,&(ctx->register_ctx[i].views[j])); if(err){ pcilib_error("can't write to the register with the formula view %s", unit); @@ -249,7 +249,10 @@ int operation_enum(pcilib_t *ctx, void *params, char* name, int view2reg, pcilib }else if (view2reg==0){ for(j=0; ((pcilib_enum_t*)(params))[j].name;j++){ if (*regval<=((pcilib_enum_t*)(params))[j].max && *regval>=((pcilib_enum_t*)(params))[j].min){ - name=(char*)realloc(name,strlen(((pcilib_enum_t*)(params))[j].name)*sizeof(char)); + if(viewval_size