GRASS Programmer's Manual
6.5.svn(2014)-r66266
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
linkm.c
Go to the documentation of this file.
1
2
/*
3
** Written by David Gerdes US Army Construction Engineering Research Lab
4
** April 1992
5
** Copyright 1992 USA-CERL All rights reserved.
6
**
7
*/
8
9
/*
10
** takes 1st command line argument and stuffs each letter of it into
11
** a linked list. then prints it back out to stdout.
12
** If a second argument is specified, the first argument is put in the
13
** list backwards.
14
*/
15
#include <stdio.h>
16
#include <grass/linkm.h>
17
18
struct
link
19
{
20
char
let
;
21
struct
link
*
next
;
22
};
23
24
int
main
(
int
argc,
char
*argv[])
25
{
26
register
int
i;
27
VOID_T
*head;
28
struct
link
List, *tmp, *p;
29
int
rev = 0;
30
31
32
/*
33
List.next = NULL;
34
List.let = ' ';
35
*/
36
37
38
head = (
VOID_T
*)
link_init
(
sizeof
(
struct
link
));
39
40
41
for
(i = 0; i < 2000000; i++) {
42
/*
43
p = (struct link *) malloc (sizeof (struct link));
44
free (p);
45
*/
46
p = (
struct
link
*)
link_new
(head);
47
link_destroy
(head, p);
48
}
49
50
link_cleanup
(head);
51
52
exit(0);
53
}
VOID_T
#define VOID_T
Definition:
qtree.h:17
link_init
struct link_head * link_init(int size)
Definition:
linkm/init.c:40
link_new
struct link_head * link_new(struct link_head *Head)
Definition:
new.c:12
link::next
struct link * next
Definition:
linkm.c:21
link_cleanup
void link_cleanup(struct link_head *Head)
Definition:
linkm/init.c:64
link::let
char let
Definition:
linkm.c:20
main
int main(int argc, char *argv[])
Definition:
gem/main.c:302
link
Definition:
linkm.c:18
link_destroy
void link_destroy(struct link_head *Head, VOID_T *ptr)
Definition:
destroy.c:10
lib
linkm
linkm.c
Generated on Sat Jan 2 2016 01:46:48 for GRASS Programmer's Manual by
1.8.5