summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorMichael McConville <mmcconville@mykolab.com>2015-12-08 21:00:39 -0500
committerWill Estes <westes575@gmail.com>2015-12-09 09:48:39 -0500
commitc53d722b0b4e81b08cfc2f9ff6675a7abe0de2c3 (patch)
tree4e19f81d30f1b2323c0a89a09c0d92359e713634 /src/misc.c
parentc03bef5411d3231f42445932d1971d656f020817 (diff)
Removed flex_alloc; cleaned up style.
The function flex_alloc() was just a wrapper around malloc(). Since this only added unclarity, and the flex_alloc() function is likely a legacy of olden times, remove it in favor of calls to malloc() directly. Style elements cleaned up: * superfluous spacing around parentheses * non-constant initialization in variable declarations * needless casts * almost all uses of assignments as subexpressions
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/misc.c b/src/misc.c
index 2bea688..a67adbe 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -60,7 +60,7 @@ static void sko_push(bool dc)
{
if(!sko_stack){
sko_sz = 1;
- sko_stack = (struct sko_state*)flex_alloc(sizeof(struct sko_state)*sko_sz);
+ sko_stack = malloc(sizeof(struct sko_state) * sko_sz);
if (!sko_stack)
flexfatal(_("allocation of sko_stack failed"));
sko_len = 0;
@@ -168,7 +168,7 @@ void *allocate_array (int size, size_t element_size)
void *mem;
size_t num_bytes = element_size * size;
- mem = flex_alloc (num_bytes);
+ mem = malloc(num_bytes);
if (!mem)
flexfatal (_
("memory allocation failed in allocate_array()"));
@@ -889,11 +889,14 @@ void transition_struct_out (element_v, element_n)
/* The following is only needed when building flex's parser using certain
* broken versions of bison.
+ *
+ * XXX: this is should go soon
*/
void *yy_flex_xmalloc (int size)
{
- void *result = flex_alloc ((size_t) size);
+ void *result;
+ result = malloc(size);
if (!result)
flexfatal (_
("memory allocation failed in yy_flex_xmalloc()"));