Ignore:
Timestamp:
Apr 28, 2018, 9:20:28 AM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, with_gc
Children:
6926a6d
Parents:
aa5fdac
Message:

shorten experimental code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/evaluation/c-bench.c

    raa5fdac rac4dad2  
    55#include "c-stack.h"
    66
    7 char* new_char( char c ) {
    8         char* q = malloc(sizeof(char)); /***/
     7char * new_char( char c ) {
     8        char* q = malloc( sizeof(char) ); /***/
    99        *q = c;
    1010        return q;
    1111}
    1212
    13 short* new_short( short s ) {
    14         short* q = malloc(sizeof(short)); /***/
     13short * new_short( short s ) {
     14        short* q = malloc( sizeof(short) ); /***/
    1515        *q = s;
    1616        return q;
     
    1818
    1919int* new_int( int i ) {
    20         int* q = malloc(sizeof(int)); /***/
     20        int* q = malloc( sizeof(int) ); /***/
    2121        *q = i;
    2222        return q;
    2323}
    2424
    25 void* copy_char( const void* p ) { return new_char( *(const char*)p ); } /***/
    26 void* copy_short( const void* p ) { return new_short( *(const short*)p ); } /***/
    27 void* copy_int( const void* p ) { return new_int( *(const int*)p ); } /***/
    28 void* copy_pair_short_char( const void* p ) { return copy_pair( p, copy_short, copy_char ); } /***/
    29 void free_pair_short_char( void* p ) { free_pair( p, free, free ); } /***/
     25void * copy_char( const void * p ) { return new_char( *(const char*)p ); } /***/
     26void * copy_short( const void * p ) { return new_short( *(const short*)p ); } /***/
     27void * copy_int( const void * p ) { return new_int( *(const int*)p ); } /***/
     28void * copy_pair_short_char( const void * p ) { return copy_pair( p, copy_short, copy_char ); } /***/
     29void free_pair_short_char( void * p ) { free_pair( p, free, free ); } /***/
    3030
    3131int cmp_char( const void* a, const void* b ) { /***/
     
    3737}
    3838
    39 int main(int argc, char** argv) {
     39int main(int argc, char * argv[] ) {
    4040        int maxi = 0, vali = 42;
    4141        struct stack si = new_stack(), ti;
Note: See TracChangeset for help on using the changeset viewer.