X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=form%2Ffty_enum.c;h=d3351644ef1849f2aa9de6dfd7ab31674cc08e8c;hp=c249b5b039632a203c42dad423e9b0622cb301c3;hb=5ed80e8d7031c3fa12b4915d5e1f040257a24323;hpb=f5da57ad7eb397b1001e2fca9cb0e278a6564716;ds=sidebyside diff --git a/form/fty_enum.c b/form/fty_enum.c index c249b5b0..d3351644 100644 --- a/form/fty_enum.c +++ b/form/fty_enum.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. * + * Copyright (c) 1998-2009,2010 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 * @@ -34,7 +34,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_enum.c,v 1.24 2009/11/07 20:17:58 tom Exp $") +MODULE_ID("$Id: fty_enum.c,v 1.26 2010/05/01 21:11:07 tom Exp $") typedef struct { @@ -79,7 +79,7 @@ Generic_Enum_Type(void *arg) char **kptarget; int ccase, cunique; - T((T_CREATE("enumARG %p"), argp)); + T((T_CREATE("enumARG %p"), (void *)argp)); kwds = params->kwds; ccase = params->ccase; cunique = params->cunique; @@ -102,12 +102,14 @@ Generic_Enum_Type(void *arg) argp->kwds = typeMalloc(char *, cnt + 1); kp = kwds; - kptarget = argp->kwds; - while (kptarget && kp && (*kp)) + if ((kptarget = argp->kwds) != 0) { - (*kptarget++) = strdup(*kp++); + while (kp && (*kp)) + { + (*kptarget++) = strdup(*kp++); + } + *kptarget = (char *)0; } - *kptarget = (char *)0; } } } @@ -155,7 +157,7 @@ Copy_Enum_Type(const void *argp) if (result) { - T((T_CREATE("enumARG %p"), result)); + T((T_CREATE("enumARG %p"), (void *)result)); *result = *ap; if (ap->count > 0) @@ -164,12 +166,14 @@ Copy_Enum_Type(const void *argp) char **kp = ap->kwds; result->kwds = typeMalloc(char *, 1 + ap->count); - kptarget = result->kwds; - while (kptarget && kp && (*kp)) + if ((kptarget = result->kwds) != 0) { - (*kptarget++) = strdup(*kp++); + while (kp && (*kp)) + { + (*kptarget++) = strdup(*kp++); + } + *kptarget = (char *)0; } - *kptarget = (char *)0; } } }