Some consistency changes to library & headers flags.
[splint-patched.git] / test / structassign.c
blob96e325be3140e9ae8b1c4ee369d8740eca3d3e39
1 # include <stdio.h>
2 # include <strings.h>
3 # include <stdlib.h>
4 # include <assert.h>
6 typedef struct
8 int x;
9 char *name;
10 } record;
12 record copyrecord (record x)
14 record copy = x;
15 return copy; /* 1. Released storage x.name reachable from parameter at ... */
18 record copyrecord2 (record x)
20 record copy;
22 copy = x;
23 return copy; /* 2. Released storage x.name reachable from parameter at ... */
26 record copyrecord3 (record x)
28 return x; /* 3. Released storage x.name reachable from parameter at ... */
31 int main ()
33 record r;
34 record rc;
36 r.x = 3;
37 r.name = (char *) malloc (sizeof (char) * 100);
38 assert (r.name != NULL);
39 strcpy (r.name, "yo");
41 rc = r;
43 printf ("rc: %s", rc.name);
45 return r.x; /* 4. Only storage rc.name (type char *) derived from variable ... */