[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57148] trunk/blender/source/blender/ blenlib/intern/listbase.c: remove null checks for list functions, all hard asserts so we would have noticed problems already.

Campbell Barton ideasman42 at gmail.com
Thu May 30 21:05:47 CEST 2013


Revision: 57148
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57148
Author:   campbellbarton
Date:     2013-05-30 19:05:46 +0000 (Thu, 30 May 2013)
Log Message:
-----------
remove null checks for list functions, all hard asserts so we would have noticed problems already.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/listbase.c

Modified: trunk/blender/source/blender/blenlib/intern/listbase.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/listbase.c	2013-05-30 18:42:32 UTC (rev 57147)
+++ trunk/blender/source/blender/blenlib/intern/listbase.c	2013-05-30 19:05:46 UTC (rev 57148)
@@ -71,8 +71,6 @@
 	Link *link = vlink;
 
 	if (link == NULL) return;
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return;
 
 	link->next = listbase->first;
 	link->prev = NULL;
@@ -91,8 +89,6 @@
 	Link *link = vlink;
 
 	if (link == NULL) return;
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return;
 
 	link->next = NULL;
 	link->prev = listbase->last;
@@ -111,8 +107,6 @@
 	Link *link = vlink;
 
 	if (link == NULL) return;
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return;
 
 	if (link->next) link->next->prev = link->prev;
 	if (link->prev) link->prev->next = link->next;
@@ -144,8 +138,6 @@
 	Link *link = vlink;
 
 	if (link == NULL) return;
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return;
 
 	BLI_remlink(listbase, link);
 	MEM_freeN(link);
@@ -164,8 +156,6 @@
 	Link *next = NULL;
 	
 	if (cmp == NULL) return;
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return;
 
 	if (listbase->first != listbase->last) {
 		for (previous = listbase->first, current = previous->next; current; current = next) {
@@ -194,8 +184,6 @@
 
 	/* newlink before nextlink */
 	if (newlink == NULL) return;
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return;
 
 	/* empty list */
 	if (listbase->first == NULL) {
@@ -237,8 +225,6 @@
 
 	/* newlink before nextlink */
 	if (newlink == NULL) return;
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return;
 
 	/* empty list */
 	if (listbase->first == NULL) {
@@ -276,10 +262,6 @@
 void BLI_freelist(ListBase *listbase)
 {
 	Link *link, *next;
-
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) 
-		return;
 	
 	link = listbase->first;
 	while (link) {
@@ -298,9 +280,6 @@
 void BLI_freelistN(ListBase *listbase)
 {
 	Link *link, *next;
-
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return;
 	
 	link = listbase->first;
 	while (link) {
@@ -375,9 +354,7 @@
 {
 	Link *link = NULL;
 	int number = 0;
-	
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return -1;
+
 	if (vlink == NULL) return -1;
 	
 	link = listbase->first;
@@ -401,9 +378,6 @@
 	Link *link = NULL;
 	const char *id_iter;
 
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return NULL;
-
 	for (link = listbase->first; link; link = link->next) {
 		id_iter = ((const char *)link) + offset;
 
@@ -424,9 +398,6 @@
 	Link *link = NULL;
 	const char *id_iter;
 
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return NULL;
-
 	for (link = listbase->last; link; link = link->prev) {
 		id_iter = ((const char *)link) + offset;
 
@@ -447,9 +418,6 @@
 	Link *link = NULL;
 	const char *id_iter;
 
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return NULL;
-
 	for (link = listbase->first; link; link = link->next) {
 		/* exact copy of BLI_findstring(), except for this line */
 		id_iter = *((const char **)(((const char *)link) + offset));
@@ -471,9 +439,6 @@
 	Link *link = NULL;
 	const char *id_iter;
 
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return NULL;
-
 	for (link = listbase->last; link; link = link->prev) {
 		/* exact copy of BLI_rfindstring(), except for this line */
 		id_iter = *((const char **)(((const char *)link) + offset));
@@ -495,9 +460,6 @@
 	Link *link = NULL;
 	const void *ptr_iter;
 
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return NULL;
-
 	for (link = listbase->first; link; link = link->next) {
 		/* exact copy of BLI_findstring(), except for this line */
 		ptr_iter = *((const void **)(((const char *)link) + offset));
@@ -519,9 +481,6 @@
 	Link *link = NULL;
 	const void *ptr_iter;
 
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return NULL;
-
 	for (link = listbase->last; link; link = link->prev) {
 		/* exact copy of BLI_rfindstring(), except for this line */
 		ptr_iter = *((const void **)(((const char *)link) + offset));
@@ -544,9 +503,6 @@
 	const char *id_iter;
 	int i = 0;
 
-	BLI_assert(listbase != NULL);
-	if (listbase == NULL) return -1;
-
 	link = listbase->first;
 	while (link) {
 		id_iter = ((const char *)link) + offset;




More information about the Bf-blender-cvs mailing list