summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael McConville <mmcconville@mykolab.com>2015-12-08 21:16:52 -0500
committerWill Estes <westes575@gmail.com>2015-12-09 09:53:57 -0500
commitd95947343e8a52957048b1d0b72c262183f2723f (patch)
tree94ece9fd39c511e1a460881e6bde7b462c804c93 /src
parent1cc5d870326d0c574a21bbe85457bfc50d6cc43e (diff)
Removed flex_free()i, corrected buf_destroy logic.
As with flex_alloc(), replace with direct calls to free(). The function buf_destroy is now null safe and the logic was corrected to free() correctly.
Diffstat (limited to 'src')
-rw-r--r--src/buf.c11
-rw-r--r--src/dfa.c4
-rw-r--r--src/flexdef.h2
-rw-r--r--src/gen.c2
-rw-r--r--src/scan.l11
5 files changed, 10 insertions, 20 deletions
diff --git a/src/buf.c b/src/buf.c
index 5213303..6f6bd9a 100644
--- a/src/buf.c
+++ b/src/buf.c
@@ -79,7 +79,7 @@ struct Buf *buf_prints (struct Buf *buf, const char *fmt, const char *s)
flexfatal (_("Allocation of buffer to print string failed"));
snprintf (t, tsz, fmt, s);
buf = buf_strappend (buf, t);
- flex_free (t);
+ free(t);
return buf;
}
@@ -107,7 +107,7 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno)
*dst++ = '\n';
*dst = '\0';
buf = buf_strappend (buf, t);
- flex_free (t);
+ free(t);
return buf;
}
@@ -209,9 +209,10 @@ void buf_init (struct Buf *buf, size_t elem_size)
/* frees memory */
void buf_destroy (struct Buf *buf)
{
- if (buf && buf->elts)
- flex_free (buf->elts);
- buf->elts = NULL;
+ if (buf) {
+ free(buf->elts);
+ buf->elts = NULL;
+ }
}
diff --git a/src/dfa.c b/src/dfa.c
index 442b25a..ba18744 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -793,8 +793,8 @@ void ntod (void)
mkdeftbl ();
}
- flex_free ((void *) accset);
- flex_free ((void *) nset);
+ free(accset);
+ free(nset);
}
diff --git a/src/flexdef.h b/src/flexdef.h
index 098eb04..dc8cd36 100644
--- a/src/flexdef.h
+++ b/src/flexdef.h
@@ -677,8 +677,6 @@ extern int num_backing_up, bol_needed;
void *allocate_array PROTO ((int, size_t));
void *reallocate_array PROTO ((void *, int, size_t));
-void flex_free PROTO ((void *));
-
#define allocate_integer_array(size) \
allocate_array(size, sizeof(int))
diff --git a/src/gen.c b/src/gen.c
index d8ee8df..5b7b825 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -1476,7 +1476,7 @@ void gentabs (void)
}
/* End generating yy_chk */
- flex_free ((void *) acc_array);
+ free(acc_array);
}
diff --git a/src/scan.l b/src/scan.l
index c5c25ec..1347d45 100644
--- a/src/scan.l
+++ b/src/scan.l
@@ -231,7 +231,7 @@ M4QEND "]]"
[[:digit:]]+ linenum = myctoi( yytext );
\"[^"\n]*\" {
- flex_free( (void *) infilename );
+ free(infilename);
infilename = xstrdup(yytext + 1);
infilename[strlen( infilename ) - 1] = '\0';
}
@@ -1009,12 +1009,3 @@ void set_input_file( char *file )
linenum = 1;
}
-
-
-/* Wrapper routines for accessing the scanner's malloc routines. */
-
-void flex_free( void *ptr )
- {
- if ( ptr )
- free( ptr );
- }