Skip to content

Commit 514c329

Browse files
committed
rename
1 parent 210e3ff commit 514c329

File tree

7 files changed

+44
-44
lines changed

7 files changed

+44
-44
lines changed

src/foo-consumer.c

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/foo.c

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/foo.h

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/opaque-consumer.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <stdio.h>
2+
3+
#include "opaque.h"
4+
5+
int
6+
main(void)
7+
{
8+
opaque_t h; // has to be a pointer
9+
10+
// will not compile:
11+
// printf("%zu\n", sizeof (struct opaque));
12+
13+
h = getOpaque();
14+
doStuff(h);
15+
}

src/opaque.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <stdlib.h>
2+
3+
#include "opaque_impl.h"
4+
5+
struct opaque *
6+
getOpaque(void)
7+
{
8+
return (malloc(sizeof (struct opaque)));
9+
}
10+
11+
void
12+
doStuff(struct opaque *f)
13+
{
14+
f->x = 1;
15+
f->y = 2;
16+
}

src/opaque.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* This is public header file, to be distributed with the library built
3+
* from opaque.c
4+
*/
5+
6+
struct opaque;
7+
8+
typedef struct opaque *opaque_t;
9+
10+
void doStuff(struct opaque *f);
11+
struct opaque *getOpaque(void);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
22
* This is supposed to be a private header file, not shipped with the library
3-
* built from foo.c.
3+
* built from opaque.c.
44
*/
55

6-
struct foo {
6+
struct opaque {
77
int x;
88
int y;
99
};

0 commit comments

Comments
 (0)