CVS: beepcore-c/utility bp_hash.c,1.3,1.4 bp_queue.c,1.6,1.7 bp_slist_utility.c,1.3,1.4
Chris Hanson <[email protected]> Tue, 13 Aug 2002 10:34:44 -0700
| Newsgroups | gmane.network.beep.beepcore.c.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/beepcore-c/beepcore-c/utility
In directory usw-pr-cvs1:/tmp/cvs-serv17814/utility
Modified Files:
bp_hash.c bp_queue.c bp_slist_utility.c
Log Message:
Miscellaneous small changes from Matt Small.
Index: bp_hash.c
===================================================================
RCS file: /cvsroot/beepcore-c/beepcore-c/utility/bp_hash.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** bp_hash.c 2 Aug 2002 15:08:33 -0000 1.3
--- bp_hash.c 13 Aug 2002 17:34:42 -0000 1.4
***************
*** 22,25 ****
--- 22,27 ----
#include <beepcore-c/bp_hash.h>
#include <beepcore-c/bp_slist_utility.h>
+ /* for PRE() */
+ #include <beepcore-c/CBEEPint.h>
/* private prototypes */
***************
*** 430,433 ****
--- 432,437 ----
HASH_KEY_VALUE *newdata;
+ PRE (htable != NULL);
+
len = size;
if (len <= 0)
***************
*** 595,598 ****
--- 599,604 ----
unsigned long hash_nbr;
unsigned long *testint;
+
+ PRE (htable != NULL);
if (htable->hash_type)
Index: bp_queue.c
===================================================================
RCS file: /cvsroot/beepcore-c/beepcore-c/utility/bp_queue.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** bp_queue.c 2 Aug 2002 15:08:33 -0000 1.6
--- bp_queue.c 13 Aug 2002 17:34:42 -0000 1.7
***************
*** 47,51 ****
{
! if (!q)
return;
--- 47,51 ----
{
! if (q == NULL)
return;
Index: bp_slist_utility.c
===================================================================
RCS file: /cvsroot/beepcore-c/beepcore-c/utility/bp_slist_utility.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** bp_slist_utility.c 2 Aug 2002 15:08:33 -0000 1.3
--- bp_slist_utility.c 13 Aug 2002 17:34:42 -0000 1.4
***************
*** 42,46 ****
#include <stdio.h>
#include <beepcore-c/bp_slist_utility.h>
!
/*---------------------------------------------------------------**
--- 42,46 ----
#include <stdio.h>
#include <beepcore-c/bp_slist_utility.h>
! #include <beepcore-c/CBEEPint.h>
/*---------------------------------------------------------------**
***************
*** 316,323 ****
/*---------------------------------------------------------------**
** **
! ** Name: bp_slist__remove_index **
** **
** Description: **
** remove and frees a node based on index position in list **
**---------------------------------------------------------------*/
--- 316,325 ----
/*---------------------------------------------------------------**
** **
! ** Name: bp_slist__remove_index **
** **
** Description: **
** remove and frees a node based on index position in list **
+ ** If list is NULL, nothing is done (the function **
+ ** immediately returns NULL) **
**---------------------------------------------------------------*/
***************
*** 327,333 ****
bp_slist *prevlist;
prevlist = NULL;
templist = list;
! while (index > 0 && templist)
{
prevlist = templist;
--- 329,338 ----
bp_slist *prevlist;
+ if (list == NULL)
+ return list;
+
prevlist = NULL;
templist = list;
! while ((index > 0) && (templist != NULL))
{
prevlist = templist;
***************
*** 335,339 ****
index--;
}
! if (templist)
{
if (prevlist)
--- 340,344 ----
index--;
}
! if (templist != NULL)
{
if (prevlist)
***************
*** 379,383 ****
/*---------------------------------------------------------------**
** **
! ** Name: bp_slist__index **
** **
** Description: **
--- 384,388 ----
/*---------------------------------------------------------------**
** **
! ** Name: bp_slist__index **
** **
** Description: **
***************
*** 387,391 ****
bp_slist *bp_slist__index(bp_slist *list,int index)
{
! while (index > 0 && list)
{
index--;
--- 392,397 ----
bp_slist *bp_slist__index(bp_slist *list,int index)
{
! PRE (list != NULL);
! while ((index > 0) && (list != NULL))
{
index--;
***************
*** 397,401 ****
/*---------------------------------------------------------------**
** **
! ** Name: bp_slist__index_data **
** **
** Description: **
--- 403,407 ----
/*---------------------------------------------------------------**
** **
! ** Name: bp_slist__index_data **
** **
** Description: **
-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31