diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-21 21:05:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-21 21:05:41 +0400 |
commit | 8bf5ec4f8af5d2129387d29dd2b552ec3b1850ca (patch) | |
tree | ec187676f9a60ddf3f5ac1802991da13c02ccca4 /source | |
parent | cfc13e179a47c9ba9985dbf745e17e9057f6592e (diff) |
code cleanup: de-duplicate BLI_ghashIterator_new/init and disable unused text undo print function.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_text.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 13 |
3 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 2406fa51c84..24fd763d078 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -86,7 +86,6 @@ void txt_sel_all (struct Text *text); 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 @@ int txt_setcurr_tab_spaces(struct Text *text, int space); 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); diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index f1b4626ec73..8d63be5fbd5 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1496,6 +1496,7 @@ static int max_undo_test(Text *text, int x) return 1; } +#if 0 /* UNUSED */ static void dump_buffer(Text *text) { int i = 0; @@ -1660,6 +1661,7 @@ void txt_print_undo(Text *text) i++; } } +#endif static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short value) { diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index d30d3f3d256..10b3c01d274 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -34,6 +34,7 @@ #include <string.h> #include <stdlib.h> +#include <limits.h> #include "MEM_guardedalloc.h" @@ -255,22 +256,14 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef 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) |