(DelParmList): Fix bug: Handle NULL input.
Thanks to Matthias Koeppe. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@581 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
307207ea64
commit
3233009c09
1 changed files with 11 additions and 10 deletions
|
|
@ -1,17 +1,17 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* parms.cxx
|
* parms.cxx
|
||||||
*
|
*
|
||||||
* Parameter list class.
|
* Parameter list class.
|
||||||
*
|
*
|
||||||
* !!! This file is deprecated and is being replaced !!!
|
* !!! This file is deprecated and is being replaced !!!
|
||||||
*
|
*
|
||||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2000. The University of Chicago
|
* Copyright (C) 1998-2000. The University of Chicago
|
||||||
* Copyright (C) 1995-1998. The University of Utah and The Regents of the
|
* Copyright (C) 1995-1998. The University of Utah and The Regents of the
|
||||||
* University of California.
|
* University of California.
|
||||||
*
|
*
|
||||||
* See the file LICENSE for information on usage and redistribution.
|
* See the file LICENSE for information on usage and redistribution.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static char cvsroot[] = "$Header$";
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
@ -118,11 +118,11 @@ CopyParmList(ParmList *l) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (l) {
|
if (l) {
|
||||||
nl = (ParmList *) malloc(sizeof(ParmList));
|
nl = (ParmList *) malloc(sizeof(ParmList));
|
||||||
nl->nparms = l->nparms;
|
nl->nparms = l->nparms;
|
||||||
nl->maxparms = l->maxparms;
|
nl->maxparms = l->maxparms;
|
||||||
nl->parms = (Parm **) malloc(l->maxparms*sizeof(Parm*));
|
nl->parms = (Parm **) malloc(l->maxparms*sizeof(Parm*));
|
||||||
|
|
||||||
for (i = 0; i < l->maxparms; i++) {
|
for (i = 0; i < l->maxparms; i++) {
|
||||||
if (l->parms[i])
|
if (l->parms[i])
|
||||||
nl->parms[i] = CopyParm(l->parms[i]);
|
nl->parms[i] = CopyParm(l->parms[i]);
|
||||||
|
|
@ -138,9 +138,10 @@ CopyParmList(ParmList *l) {
|
||||||
/* ------------------------------------------------------------------
|
/* ------------------------------------------------------------------
|
||||||
* DelParmList()
|
* DelParmList()
|
||||||
* ------------------------------------------------------------------ */
|
* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
void DelParmList(ParmList *l) {
|
void DelParmList(ParmList *l) {
|
||||||
int i;
|
int i;
|
||||||
|
if (NULL == l) return;
|
||||||
for (i = 0; i < l->maxparms; i++) {
|
for (i = 0; i < l->maxparms; i++) {
|
||||||
if (l->parms[i]) DelParm(l->parms[i]);
|
if (l->parms[i]) DelParm(l->parms[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -201,12 +202,12 @@ void ParmList_insert(ParmList *l, Parm *p, int pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set new parameter */
|
/* Set new parameter */
|
||||||
|
|
||||||
l->parms[pos] = CopyParm(p);
|
l->parms[pos] = CopyParm(p);
|
||||||
l->nparms++;
|
l->nparms++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------
|
/* ------------------------------------------------------------------
|
||||||
* void ParmList_del()
|
* void ParmList_del()
|
||||||
* ------------------------------------------------------------------ */
|
* ------------------------------------------------------------------ */
|
||||||
|
|
@ -250,7 +251,7 @@ int ParmList_numarg(ParmList *l) {
|
||||||
for (i = 0; i < l->nparms; i++) {
|
for (i = 0; i < l->nparms; i++) {
|
||||||
if (!l->parms[i]->ignore)
|
if (!l->parms[i]->ignore)
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue