X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=form%2Ffld_def.c;h=681a3713e8c7a07e92160e14e274a00ae1ec9ef5;hp=b8c69d30a4292d8572ed4069b5a1d4274fbc2005;hb=cc387b11f421650091d84640e05825ea5161ac66;hpb=b94faec6aab7c3613c1e7d217f6df6f42d929234 diff --git a/form/fld_def.c b/form/fld_def.c index b8c69d30..681a3713 100644 --- a/form/fld_def.c +++ b/form/fld_def.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.37 2009/02/28 19:00:51 juergen Exp $") +MODULE_ID("$Id: fld_def.c,v 1.40 2012/03/11 00:37:16 tom Exp $") /* this can't be readonly */ static FIELD default_field = @@ -65,8 +65,7 @@ static FIELD default_field = NCURSES_FIELD_EXTENSION }; -NCURSES_EXPORT_VAR(FIELD *) -_nc_Default_Field = &default_field; +NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field; /*--------------------------------------------------------------------------- | Facility : libnform @@ -186,10 +185,12 @@ _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp) { if ((typ->status & _LINKED_TYPE) != 0) { - assert(argp != 0); - _nc_Free_Argument(typ->left, argp->left); - _nc_Free_Argument(typ->right, argp->right); - free(argp); + if (argp != 0) + { + _nc_Free_Argument(typ->left, argp->left); + _nc_Free_Argument(typ->right, argp->right); + free(argp); + } } else { @@ -291,16 +292,16 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ (New_Field = typeMalloc(FIELD, 1)) != 0) { - T((T_CREATE("field %p"), New_Field)); + T((T_CREATE("field %p"), (void *)New_Field)); *New_Field = default_field; - New_Field->rows = rows; - New_Field->cols = cols; + New_Field->rows = (short) rows; + New_Field->cols = (short) cols; New_Field->drows = rows + nrow; New_Field->dcols = cols; - New_Field->frow = frow; - New_Field->fcol = fcol; + New_Field->frow = (short) frow; + New_Field->fcol = (short) fcol; New_Field->nrow = nrow; - New_Field->nbuf = nbuf; + New_Field->nbuf = (short) nbuf; New_Field->link = New_Field; #if USE_WIDEC_SUPPORT @@ -355,7 +356,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) NCURSES_EXPORT(int) free_field(FIELD *field) { - T((T_CALLED("free_field(%p)"), field)); + T((T_CALLED("free_field(%p)"), (void *)field)); if (!field) { RETURN(E_BAD_ARGUMENT);