summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael McConville <mmcconville@mykolab.com>2015-12-07 19:44:10 -0500
committerWill Estes <westes575@gmail.com>2015-12-07 21:28:21 -0500
commitc03bef5411d3231f42445932d1971d656f020817 (patch)
tree90040d0915d1bd68db3a70fc011d56135909eaaa /tests
parent53e3088d75eb966101e4f229a0fe8e0fdd73ab7e (diff)
Remove allocation casts
Diffstat (limited to 'tests')
-rw-r--r--tests/bison_nr_scanner.l2
-rw-r--r--tests/bison_yylloc_scanner.l2
-rw-r--r--tests/bison_yylval_scanner.l2
-rw-r--r--tests/mem_nr.l8
-rw-r--r--tests/mem_r.l8
-rw-r--r--tests/pthread.l2
-rw-r--r--tests/string_nr.l2
-rw-r--r--tests/string_r.l2
-rw-r--r--tests/yyextra.l8
9 files changed, 18 insertions, 18 deletions
diff --git a/tests/bison_nr_scanner.l b/tests/bison_nr_scanner.l
index 4378e5a..0bd871c 100644
--- a/tests/bison_nr_scanner.l
+++ b/tests/bison_nr_scanner.l
@@ -56,7 +56,7 @@ static char* STRDUP(char* s1);
static char* STRDUP(char* s1)
{
- char* s2 = (char*)malloc(strlen(s1)+1);
+ char* s2 = malloc(strlen(s1)+1);
sprintf(s2,"%s",s1);
return s2;
}
diff --git a/tests/bison_yylloc_scanner.l b/tests/bison_yylloc_scanner.l
index 3708237..eab898c 100644
--- a/tests/bison_yylloc_scanner.l
+++ b/tests/bison_yylloc_scanner.l
@@ -59,7 +59,7 @@ static char* STRDUP(char* s1);
static char* STRDUP(char* s1)
{
- char* s2 = (char*)malloc(strlen(s1)+1);
+ char* s2 = malloc(strlen(s1)+1);
sprintf(s2,"%s",s1);
return s2;
}
diff --git a/tests/bison_yylval_scanner.l b/tests/bison_yylval_scanner.l
index db99fa0..1e93fc1 100644
--- a/tests/bison_yylval_scanner.l
+++ b/tests/bison_yylval_scanner.l
@@ -75,7 +75,7 @@ enum yesno_t { no=0, yes=1 };
static char* STRDUP(char* s1)
{
- char* s2 = (char*)malloc(strlen(s1)+1);
+ char* s2 = malloc(strlen(s1)+1);
sprintf(s2,"%s",s1);
return s2;
}
diff --git a/tests/mem_nr.l b/tests/mem_nr.l
index c7a6ce0..f25848f 100644
--- a/tests/mem_nr.l
+++ b/tests/mem_nr.l
@@ -91,12 +91,12 @@ void * yyalloc(yy_size_t n)
int i;
total_mem += n;
- p = (void*)malloc(n);
+ p = malloc(n);
if( nptrs >= arrsz){
/* increase array size by 1 */
arrsz++;
- ptrs = (struct memsz*)realloc( ptrs, arrsz * sizeof(struct memsz));
+ ptrs = realloc(ptrs, arrsz * sizeof(struct memsz));
ptrs[nptrs].p = 0;
ptrs[nptrs].sz = 0;
}
@@ -121,7 +121,7 @@ void * yyrealloc(void* p, yy_size_t n)
if ( ptrs[i].p == p){
total_mem -= ptrs[i].sz;
total_mem += n;
- ptrs[i].p = (void*)realloc(p,n);
+ ptrs[i].p = realloc(p,n);
ptrs[i].sz = n;
printf("yyflex_realloc(%#10lx,%8ld) total=%8ld return=%8lx\n",
@@ -161,7 +161,7 @@ int
main ()
{
arrsz = 1;
- ptrs = (struct memsz*)calloc(1,sizeof(struct memsz));
+ ptrs = calloc(1, sizeof(struct memsz));
nptrs = 0;
yyin = stdin;
diff --git a/tests/mem_r.l b/tests/mem_r.l
index cbfe08c..33b9888 100644
--- a/tests/mem_r.l
+++ b/tests/mem_r.l
@@ -93,12 +93,12 @@ void * yyalloc(yy_size_t n , void* yyscanner)
int i;
total_mem += n;
- p = (void*)malloc(n);
+ p = malloc(n);
if( nptrs >= arrsz){
/* increase array size by 1 */
arrsz++;
- ptrs = (struct memsz*)realloc( ptrs, arrsz * sizeof(struct memsz));
+ ptrs = realloc(ptrs, arrsz * sizeof(struct memsz));
ptrs[nptrs].p = 0;
ptrs[nptrs].sz = 0;
}
@@ -125,7 +125,7 @@ void * yyrealloc(void* p, yy_size_t n , void* yyscanner)
if ( ptrs[i].p == p){
total_mem -= ptrs[i].sz;
total_mem += n;
- ptrs[i].p = (void*)realloc(p,n);
+ ptrs[i].p = realloc(p, n);
ptrs[i].sz = n;
printf("yyflex_realloc(%#10lx,%8ld) total=%8ld return=%8lx\n",
@@ -168,7 +168,7 @@ main ()
{
yyscan_t scanner;
arrsz = 1;
- ptrs = (struct memsz*)calloc(1,sizeof(struct memsz));
+ ptrs = calloc(1, sizeof(struct memsz));
nptrs = 0;
yylex_init(&scanner);
diff --git a/tests/pthread.l b/tests/pthread.l
index 38080c1..c40c024 100644
--- a/tests/pthread.l
+++ b/tests/pthread.l
@@ -167,7 +167,7 @@ int main (int ARGC, char *ARGV[])
}
/* Allocate and initialize the locks. One for each filename in ARGV. */
- file_locks = (pthread_mutex_t*)malloc( (ARGC-1) * sizeof(pthread_mutex_t));
+ file_locks = malloc((ARGC-1) * sizeof(pthread_mutex_t));
for( i = 0; i < ARGC-1; i++)
pthread_mutex_init( &file_locks[i], NULL );
diff --git a/tests/string_nr.l b/tests/string_nr.l
index 3dd752a..e909b2d 100644
--- a/tests/string_nr.l
+++ b/tests/string_nr.l
@@ -82,7 +82,7 @@ main ()
We make a copy, since the buffer will be modified by flex.*/
printf("Testing: yy_scan_buffer(%s): ",INPUT_STRING_1); fflush(stdout);
len = strlen(INPUT_STRING_1) + 2;
- buf = (char*)malloc( len );
+ buf = malloc(len);
strcpy( buf, INPUT_STRING_1);
buf[ len -2 ] = 0; /* Flex requires two NUL bytes at end of buffer. */
buf[ len -1 ] =0;
diff --git a/tests/string_r.l b/tests/string_r.l
index d98c98a..633004a 100644
--- a/tests/string_r.l
+++ b/tests/string_r.l
@@ -87,7 +87,7 @@ main ()
We make a copy, since the buffer will be modified by flex.*/
printf("Testing: yy_scan_buffer(%s): ",INPUT_STRING_1); fflush(stdout);
len = strlen(INPUT_STRING_1) + 2;
- buf = (char*)malloc( len );
+ buf = malloc(len);
strcpy( buf, INPUT_STRING_1);
buf[ len -2 ] = 0; /* Flex requires two NUL bytes at end of buffer. */
buf[ len -1 ] =0;
diff --git a/tests/yyextra.l b/tests/yyextra.l
index 37e8821..8957cbb 100644
--- a/tests/yyextra.l
+++ b/tests/yyextra.l
@@ -68,11 +68,11 @@ main ()
struct Buffer * buf;
int i;
- buf = (struct Buffer*) malloc(sizeof(struct Buffer));
+ buf = malloc(sizeof(struct Buffer));
buf->curr_len =0;
buf->max_len = 4;
buf->grow_len = 100;
- buf->data = (char*)malloc(buf->max_len);
+ buf->data = malloc(buf->max_len);
testlex_init(&scanner);
testset_in( stdin, scanner);
@@ -100,10 +100,10 @@ static void append_char (char c, yyscan_t scanner )
if( buf->curr_len >= buf->max_len )
{
- new_buf = (struct Buffer*) malloc(sizeof(struct Buffer));
+ new_buf = malloc(sizeof(struct Buffer));
new_buf->max_len = buf->max_len + buf->grow_len;
new_buf->grow_len = buf->grow_len;
- new_buf->data = (char*)malloc(new_buf->max_len);
+ new_buf->data = malloc(new_buf->max_len);
for( new_buf->curr_len = 0;
new_buf->curr_len < buf->curr_len;
new_buf->curr_len++ )