code cleanup: de-duplicate BLI_ghashIterator_new/init and disable unused text undo print function.

This commit is contained in:
Campbell Barton 2013-07-21 17:05:41 +00:00
parent cfc13e179a
commit 8bf5ec4f8a
3 changed files with 9 additions and 11 deletions

@ -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);

@ -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)
{

@ -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)