X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=form%2Ffld_def.c;h=b8c69d30a4292d8572ed4069b5a1d4274fbc2005;hp=2aa14f776ace8e72bfd536ccf778f520eda53566;hb=bbb7fd37298f7d81386a4cf868417b9e084d7d90;hpb=5242fccf157e715ed878455a3efea6c82b840eb5 diff --git a/form/fld_def.c b/form/fld_def.c index 2aa14f77..b8c69d30 100644 --- a/form/fld_def.c +++ b/form/fld_def.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.34 2007/02/03 23:37:46 tom Exp $") +MODULE_ID("$Id: fld_def.c,v 1.37 2009/02/28 19:00:51 juergen Exp $") /* this can't be readonly */ static FIELD default_field = @@ -93,7 +93,7 @@ _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) assert(err != 0 && ap != (va_list *)0); if ((typ->status & _LINKED_TYPE) != 0) { - p = (TypeArgument *)malloc(sizeof(TypeArgument)); + p = typeMalloc(TypeArgument, 1); if (p != 0) { @@ -141,7 +141,7 @@ _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err) assert(err != 0 && argp != 0); if ((typ->status & _LINKED_TYPE) != 0) { - p = (TypeArgument *)malloc(sizeof(TypeArgument)); + p = typeMalloc(TypeArgument, 1); if (p != 0) { @@ -252,8 +252,8 @@ _nc_Free_Type(FIELD *field) if (field->type != 0) { field->type->ref--; + _nc_Free_Argument(field->type, (TypeArgument *)(field->arg)); } - _nc_Free_Argument(field->type, (TypeArgument *)(field->arg)); } /*--------------------------------------------------------------------------- @@ -289,7 +289,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) nrow >= 0 && nbuf >= 0 && ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ - (New_Field = (FIELD *)malloc(sizeof(FIELD))) != 0) + (New_Field = typeMalloc(FIELD, 1)) != 0) { T((T_CREATE("field %p"), New_Field)); *New_Field = default_field; @@ -305,7 +305,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) #if USE_WIDEC_SUPPORT New_Field->working = newpad(1, Buffer_Length(New_Field) + 1); - New_Field->expanded = (char **)calloc(1 + (unsigned)rows, sizeof(char *)); + New_Field->expanded = typeCalloc(char *, 1 + (unsigned)nbuf); #endif if (_nc_Copy_Type(New_Field, &default_field))