Changeset 53f421b for list.c


Ignore:
Timestamp:
Jun 22, 2003, 1:45:23 PM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
e4eebe8
Parents:
e187445
Message:
Reformatted context and list to new code style
File:
1 edited

Legend:

Unmodified
Added
Removed
  • list.c

    rd09e5a1 r53f421b  
    88#define GROWBY 1.5
    99
    10 int owl_list_create(owl_list *l) {
     10int owl_list_create(owl_list *l)
     11{
    1112  l->size=0;
    1213  l->list=(void **)owl_malloc(INITSIZE*sizeof(void *));
     
    1617}
    1718
    18 int owl_list_get_size(owl_list *l) {
     19int owl_list_get_size(owl_list *l)
     20{
    1921  return(l->size);
    2022}
    2123
    22 void *owl_list_get_element(owl_list *l, int n) {
     24void *owl_list_get_element(owl_list *l, int n)
     25{
    2326  if (n>l->size-1) return(NULL);
    2427  return(l->list[n]);
    2528}
    2629
    27 int owl_list_append_element(owl_list *l, void *element) {
     30int owl_list_append_element(owl_list *l, void *element)
     31{
    2832  void *ptr;
    2933 
     
    4044}
    4145
    42 int owl_list_prepend_element(owl_list *l, void *element) {
     46int owl_list_prepend_element(owl_list *l, void *element)
     47{
    4348  void *ptr;
    4449  int i;
     
    5964}
    6065
    61 int owl_list_remove_element(owl_list *l, int n) {
     66int owl_list_remove_element(owl_list *l, int n)
     67{
    6268  int i;
    6369
     
    7177
    7278/* todo: might leak memory */
    73 int owl_list_replace_element(owl_list *l, int n, void *element) {
     79int owl_list_replace_element(owl_list *l, int n, void *element)
     80{
    7481  if (n>l->size-1) return(-1);
    7582
     
    7885}
    7986
    80 void owl_list_free_all(owl_list *l, void (*elefree)(void *)) {
     87void owl_list_free_all(owl_list *l, void (*elefree)(void *))
     88{
    8189  int i;
    8290
     
    8795}
    8896
    89 void owl_list_free_simple(owl_list *l) {
     97void owl_list_free_simple(owl_list *l)
     98{
    9099  if (l->list) owl_free(l->list);
    91100}
Note: See TracChangeset for help on using the changeset viewer.