[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58482] trunk/blender/source/blender: code cleanup: de-duplicate BLI_ghashIterator_new/ init and disable unused text undo print function.

Campbell Barton ideasman42 at gmail.com
Sun Jul 21 19:05:41 CEST 2013


Revision: 58482
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58482
Author:   campbellbarton
Date:     2013-07-21 17:05:41 +0000 (Sun, 21 Jul 2013)
Log Message:
-----------
code cleanup: de-duplicate BLI_ghashIterator_new/init and disable unused text undo print function.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_text.h
    trunk/blender/source/blender/blenkernel/intern/text.c
    trunk/blender/source/blender/blenlib/intern/BLI_ghash.c

Modified: trunk/blender/source/blender/blenkernel/BKE_text.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_text.h	2013-07-21 17:04:54 UTC (rev 58481)
+++ trunk/blender/source/blender/blenkernel/BKE_text.h	2013-07-21 17:05:41 UTC (rev 58482)
@@ -86,7 +86,6 @@
 void	txt_sel_line		(struct Text *text);
 char   *txt_sel_to_buf		(struct Text *text);
 void	txt_insert_buf		(struct Text *text, const char *in_buffer);
-void	txt_print_undo		(struct Text *text);
 void	txt_undo_add_op		(struct Text *text, int op);
 void	txt_do_undo			(struct Text *text);
 void	txt_do_redo			(struct Text *text);
@@ -106,6 +105,10 @@
 bool	txt_cursor_is_line_start(struct Text *text);
 bool	txt_cursor_is_line_end(struct Text *text);
 
+#if 0
+void	txt_print_undo		(struct Text *text);
+#endif
+
 /* utility functions, could be moved somewhere more generic but are python/text related  */
 int text_check_bracket(const char ch);
 int text_check_delim(const char ch);

Modified: trunk/blender/source/blender/blenkernel/intern/text.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/text.c	2013-07-21 17:04:54 UTC (rev 58481)
+++ trunk/blender/source/blender/blenkernel/intern/text.c	2013-07-21 17:05:41 UTC (rev 58482)
@@ -1496,6 +1496,7 @@
 	return 1;
 }
 
+#if 0  /* UNUSED */
 static void dump_buffer(Text *text) 
 {
 	int i = 0;
@@ -1660,6 +1661,7 @@
 		i++;
 	}
 }
+#endif
 
 static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short value) 
 {

Modified: trunk/blender/source/blender/blenlib/intern/BLI_ghash.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_ghash.c	2013-07-21 17:04:54 UTC (rev 58481)
+++ trunk/blender/source/blender/blenlib/intern/BLI_ghash.c	2013-07-21 17:05:41 UTC (rev 58482)
@@ -34,6 +34,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <limits.h>
 
 #include "MEM_guardedalloc.h"
 
@@ -255,22 +256,14 @@
 GHashIterator *BLI_ghashIterator_new(GHash *gh)
 {
 	GHashIterator *ghi = MEM_mallocN(sizeof(*ghi), "ghash iterator");
-	ghi->gh = gh;
-	ghi->curEntry = NULL;
-	ghi->curBucket = (unsigned int)-1;
-	while (!ghi->curEntry) {
-		ghi->curBucket++;
-		if (ghi->curBucket == ghi->gh->nbuckets)
-			break;
-		ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
-	}
+	BLI_ghashIterator_init(ghi, gh);
 	return ghi;
 }
 void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
 {
 	ghi->gh = gh;
 	ghi->curEntry = NULL;
-	ghi->curBucket = (unsigned int)-1;
+	ghi->curBucket = UINT_MAX;  /* wraps to zero */
 	while (!ghi->curEntry) {
 		ghi->curBucket++;
 		if (ghi->curBucket == ghi->gh->nbuckets)




More information about the Bf-blender-cvs mailing list