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-pair.c

    raa5fdac rac4dad2  
    22#include "c-pair.h"
    33
    4 struct pair* new_pair(void* first, void* second) {
    5         struct pair* p = malloc(sizeof(struct pair)); /***/
    6         *p = (struct pair){ first, second }; /***/
     4pair * new_pair( void * first, void * second ) {
     5        pair * p = malloc( sizeof(pair) ); /***/
     6        *p = (pair){ first, second }; /***/
    77        return p;
    88}
    99
    10 struct pair* copy_pair(const struct pair* src,
    11                 void* (*copy_first)(const void*), void* (*copy_second)(const void*)) {
     10pair * copy_pair( const pair * src,
     11                void * (* copy_first)(const void* ), void * (* copy_second)(const void *)) {
    1212        return new_pair( copy_first(src->first), copy_second(src->second) );
    1313}
    1414
    15 void free_pair(struct pair* p, void (*free_first)(void*), void (*free_second)(void*)) {
    16         free_first(p->first);
    17         free_second(p->second);
    18         free(p);
     15void free_pair( pair * p, void (* free_first)(void *), void (* free_second)(void *)) {
     16        free_first( p->first );
     17        free_second( p->second );
     18        free( p );
    1919}
    2020
    21 int cmp_pair(const struct pair* a, const struct pair* b,
    22                 int (*cmp_first)(const void*, const void*), int (*cmp_second)(const void*, const void*)) {
    23         int c = cmp_first(a->first, b->first);
    24         if ( c == 0 ) c = cmp_second(a->second, b->second);
     21int cmp_pair( const pair * a, const pair * b,
     22                int (* cmp_first)(const void *, const void *), int (* cmp_second)(const void *, const void *)) {
     23        int c = cmp_first( a->first, b->first );
     24        if ( c == 0 ) c = cmp_second( a->second, b->second );
    2525        return c;
    2626}
Note: See TracChangeset for help on using the changeset viewer.