Some consistency changes to library & headers flags.
[splint-patched.git] / test / specclauses.c
blob637f642ece22cf07edabd580171c34f74e6f9f28
1 typedef struct
3 char *name;
4 char *id;
5 int year;
6 } record;
8 extern void setName (/*@special@*/ record *r, /*@only@*/ char *name)
9 /*@defines r->name@*/ ;
11 extern /*@observer@*/ char *getName (/*@special@*/ record r)
12 /*@uses r.name@*/ ;
14 extern void freeName (/*@special@*/ record r)
15 /*@releases r.name@*/ ;
17 extern /*@observer@*/ char *f (/*@only@*/ char *name, char *id)
19 record r;
21 if (0 == 1)
23 setName (&r, name);
24 return (getName (r)); /* r.name not released */
26 else if (1 == 2)
28 return (getName (r)); /* r.name not defined */
30 else if (2 == 3)
32 r.name = malloc (sizeof (char) * 12);
33 setName (&r, name); /* r.name allocated, memory leak */
34 return id; /* r.name not released */
36 else
38 setName (&r, name);
39 freeName (r);
40 printf ("%s\n", r.name); /* dead! */
41 freeName (r);
42 return id;