pintos/src/lib/stdlib.c File Reference

#include <ctype.h>
#include <debug.h>
#include <random.h>
#include <stdlib.h>
#include <stdbool.h>

Go to the source code of this file.

Functions

int atoi (const char *s)
static int compare_thunk (const void *a, const void *b, void *aux)
void qsort (void *array, size_t cnt, size_t size, int(*compare)(const void *, const void *))
static void do_swap (unsigned char *array, size_t a_idx, size_t b_idx, size_t size)
static int do_compare (unsigned char *array, size_t a_idx, size_t b_idx, size_t size, int(*compare)(const void *, const void *, void *aux), void *aux)
static void heapify (unsigned char *array, size_t i, size_t cnt, size_t size, int(*compare)(const void *, const void *, void *aux), void *aux)
void sort (void *array, size_t cnt, size_t size, int(*compare)(const void *, const void *, void *aux), void *aux)
void * bsearch (const void *key, const void *array, size_t cnt, size_t size, int(*compare)(const void *, const void *))
void * binary_search (const void *key, const void *array, size_t cnt, size_t size, int(*compare)(const void *, const void *, void *aux), void *aux)


Function Documentation

int atoi ( const char *  s  ) 

Definition at line 11 of file stdlib.c.

References ASSERT, isdigit(), isspace(), and NULL.

Referenced by expand(), main(), and parse_options().

void* binary_search ( const void *  key,
const void *  array,
size_t  cnt,
size_t  size,
int(*)(const void *, const void *, void *aux)  compare,
void *  aux 
)

Definition at line 186 of file stdlib.c.

References NULL.

Referenced by bsearch().

void* bsearch ( const void *  key,
const void *  array,
size_t  cnt,
size_t  size,
int(*)(const void *, const void *)  compare 
)

Definition at line 167 of file stdlib.c.

References binary_search(), and compare_thunk().

Referenced by verify_bsearch().

static int compare_thunk ( const void *  a,
const void *  b,
void *  aux 
) [static]

Definition at line 46 of file stdlib.c.

Referenced by bsearch(), and qsort().

static int do_compare ( unsigned char *  array,
size_t  a_idx,
size_t  b_idx,
size_t  size,
int(*)(const void *, const void *, void *aux)  compare,
void *  aux 
) [static]

Definition at line 87 of file stdlib.c.

Referenced by heapify().

static void do_swap ( unsigned char *  array,
size_t  a_idx,
size_t  b_idx,
size_t  size 
) [static]

Definition at line 68 of file stdlib.c.

Referenced by heapify(), and sort().

static void heapify ( unsigned char *  array,
size_t  i,
size_t  cnt,
size_t  size,
int(*)(const void *, const void *, void *aux)  compare,
void *  aux 
) [static]

Definition at line 98 of file stdlib.c.

References do_compare(), and do_swap().

Referenced by sort().

void qsort ( void *  array,
size_t  cnt,
size_t  size,
int(*)(const void *, const void *)  compare 
)

Definition at line 59 of file stdlib.c.

References compare_thunk(), and sort().

Referenced by test().

void sort ( void *  array,
size_t  cnt,
size_t  size,
int(*)(const void *, const void *, void *aux)  compare,
void *  aux 
)

Definition at line 133 of file stdlib.c.

References ASSERT, do_swap(), heapify(), and NULL.

Referenced by qsort().


Generated on Mon Jan 10 16:43:58 2011 for Pintos by  doxygen 1.5.6