Commit b366059646d0ae1ea73ca6a0598323b4db1fd2cf
Update methods
Charles Lehner committed on 2/10/2015, 6:00:28 PMParent: edccdfe157b8cdd74de9028777231dac30cbefe0
Files changed
README.md | changed |
main.c | changed |
pngspark.c | changed |
pngspark.h | changed |
README.md | |||
---|---|---|---|
@@ -39,8 +39,10 @@ | |||
39 | 39 … | ## API | |
40 | 40 … | ||
41 | 41 … | Generate pngsparks in your own C programs! | |
42 | 42 … | ||
43 … | +All int methods return 0 on success and nonzero on failure. | ||
44 … | + | ||
43 | 45 … | ```c | |
44 | 46 … | struct pngspark; | |
45 | 47 … | ``` | |
46 | 48 … | A png spark instance: collection of values and settings. | |
@@ -60,11 +62,11 @@ | |||
60 | 62 … | ``` | |
61 | 63 … | Process the values and write as a PNG to a file. | |
62 | 64 … | ||
63 | 65 … | ```c | |
64 | -int pngspark_end(struct pngspark *ps); | ||
66 … | +void pngspark_end(struct pngspark *ps); | ||
65 | 67 … | ``` | |
66 | -Release allocated memory for the pngspark. (Does not free `ps`, however). | ||
68 … | +Release allocated memory for the values of the pngspark. (Does not free `ps`, however). | ||
67 | 69 … | ||
68 | 70 … | ## License | |
69 | 71 … | ||
70 | 72 … | MIT |
main.c | ||
---|---|---|
@@ -79,10 +79,9 @@ | ||
79 | 79 … | |
80 | 80 … | if (pngspark_write(&ps, file) < 0) |
81 | 81 … | return 1; |
82 | 82 … | |
83 | - if (pngspark_end(&ps) < 0) | |
84 | - return 1; | |
83 … | + pngspark_end(&ps); | |
85 | 84 … | |
86 | 85 … | if (fclose(file) < 0) |
87 | 86 … | err(1, "close %s", filename); |
88 | 87 … |
pngspark.c | ||
---|---|---|
@@ -78,10 +78,9 @@ | ||
78 | 78 … | luImageRelease(img); |
79 | 79 … | return ret; |
80 | 80 … | } |
81 | 81 … | |
82 | -int pngspark_end(struct pngspark *ps) | |
82 … | +void pngspark_end(struct pngspark *ps) | |
83 | 83 … | { |
84 | 84 … | free(ps->values); |
85 | - return 0; | |
86 | 85 … | } |
87 | 86 … |
pngspark.h | ||
---|---|---|
@@ -16,7 +16,7 @@ | ||
16 | 16 … | |
17 | 17 … | int pngspark_init(struct pngspark *, size_t, const char *, double); |
18 | 18 … | int pngspark_append(struct pngspark *, double); |
19 | 19 … | int pngspark_write(struct pngspark *, FILE *); |
20 | -int pngspark_end(struct pngspark *); | |
20 … | +void pngspark_end(struct pngspark *); | |
21 | 21 … | |
22 | 22 … |
Built with git-ssb-web