Browse Source

remove pretty pointless DUK_ERR_OK and DUK_ERR_FAIL defines, which were also easy to confuse with other DUK_ERR_xxx defines

pull/2/head
Sami Vaarala 11 years ago
parent
commit
99e7897144
  1. 7
      src/duk_error.h
  2. 4
      src/duk_heap_markandsweep.c
  3. 6
      src/duk_heap_stringtable.c

7
src/duk_error.h

@ -16,7 +16,7 @@
#define DUK_ERROR_H_INCLUDED
/*
* Error codes (defined in duktape.h)
* Error codes: defined in duktape.h
*
* Error codes are used as a shorthand to throw exceptions from inside
* the implementation. The appropriate Ecmascript object is constructed
@ -25,11 +25,6 @@
* by calling code.
*/
/* FIXME: remove */
/* for function return codes */
#define DUK_ERR_OK 0 /* call successful */
#define DUK_ERR_FAIL 1 /* call failed */
/*
* Normal error
*

4
src/duk_heap_markandsweep.c

@ -887,7 +887,7 @@ int duk_heap_mark_and_sweep(duk_heap *heap, int flags) {
#ifdef DUK_USE_VOLUNTARY_GC
heap->mark_and_sweep_trigger_counter = DUK_HEAP_MARK_AND_SWEEP_TRIGGER_SKIP;
#endif
return DUK_ERR_OK;
return 0; /* OK */
}
DUK_DPRINT("garbage collect (mark-and-sweep) starting, requested flags: 0x%08x, effective flags: 0x%08x",
@ -1077,7 +1077,7 @@ int duk_heap_mark_and_sweep(duk_heap *heap, int flags) {
DUK_DPRINT("garbage collect (mark-and-sweep) finished: %d objects kept, %d strings kept, no voluntary trigger",
(int) count_keep_obj, (int) count_keep_str);
#endif
return DUK_ERR_OK;
return 0; /* OK */
}
#else /* DUK_USE_MARK_AND_SWEEP */

6
src/duk_heap_stringtable.c

@ -267,11 +267,11 @@ static int duk__resize_strtab_raw(duk_heap *heap, duk_uint32_t new_size) {
heap->st_size = new_size;
heap->st_used = new_used; /* may be less, since DELETED entries are NULLed by rehash */
return DUK_ERR_OK;
return 0; /* OK */
error:
DUK_FREE(heap, new_entries);
return DUK_ERR_FAIL;
return 1; /* FAIL */
}
static int duk__resize_strtab(duk_heap *heap) {
@ -314,7 +314,7 @@ static int duk__recheck_strtab_size(duk_heap *heap, duk_uint32_t new_used) {
/* load factor too low or high, count actually used entries and resize */
return duk__resize_strtab(heap);
} else {
return DUK_ERR_OK;
return 0; /* OK */
}
}

Loading…
Cancel
Save