Skip to content

Commit 7e0524d

Browse files
committed
Mark compilation-unit-internal symbols static
1 parent 387b325 commit 7e0524d

17 files changed

Lines changed: 104 additions & 101 deletions

src/libImaging/Arrow.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ReleaseExportedSchema(struct ArrowSchema *array) {
6060
array->release = NULL;
6161
}
6262

63-
char *
63+
static char *
6464
image_band_json(Imaging im) {
6565
char *format = "{\"bands\": [\"%s\", \"%s\", \"%s\", \"%s\"]}";
6666
char *json;
@@ -89,7 +89,7 @@ image_band_json(Imaging im) {
8989
return json;
9090
}
9191

92-
char *
92+
static char *
9393
single_band_json(Imaging im) {
9494
char *format = "{\"bands\": [\"%s\"]}";
9595
char *json;
@@ -110,7 +110,7 @@ single_band_json(Imaging im) {
110110
return json;
111111
}
112112

113-
char *
113+
static char *
114114
assemble_metadata(const char *band_json) {
115115
/* format is
116116
int32: number of key/value pairs (noted N below)
@@ -153,7 +153,7 @@ assemble_metadata(const char *band_json) {
153153
return buf;
154154
}
155155

156-
int
156+
static int
157157
export_named_type(struct ArrowSchema *schema, char *format, const char *name) {
158158
char *formatp;
159159
char *namep;
@@ -283,7 +283,7 @@ release_const_array(struct ArrowArray *array) {
283283
array->release = NULL;
284284
}
285285

286-
int
286+
static int
287287
export_single_channel_array(Imaging im, struct ArrowArray *array) {
288288
int length = im->xsize * im->ysize;
289289

@@ -330,7 +330,7 @@ export_single_channel_array(Imaging im, struct ArrowArray *array) {
330330
return 0;
331331
}
332332

333-
int
333+
static int
334334
export_fixed_pixel_array(Imaging im, struct ArrowArray *array) {
335335
int length = im->xsize * im->ysize;
336336

src/libImaging/BoxBlur.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void static inline ImagingLineBoxBlur8(
168168
#undef SAVE
169169
}
170170

171-
Imaging
171+
static Imaging
172172
ImagingHorizontalBoxBlur(Imaging imOut, Imaging imIn, float floatRadius) {
173173
ImagingSectionCookie cookie;
174174

src/libImaging/Draw.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,9 @@ typedef struct {
667667
void (*line)(Imaging im, int x0, int y0, int x1, int y1, int ink);
668668
} DRAW;
669669

670-
DRAW draw8 = {point8, hline8, line8};
671-
DRAW draw32 = {point32, hline32, line32};
672-
DRAW draw32rgba = {point32rgba, hline32rgba, line32rgba};
670+
static DRAW draw8 = {point8, hline8, line8};
671+
static DRAW draw32 = {point32, hline32, line32};
672+
static DRAW draw32rgba = {point32rgba, hline32rgba, line32rgba};
673673

674674
/* -------------------------------------------------------------------- */
675675
/* Interface */
@@ -933,7 +933,7 @@ typedef struct {
933933
int8_t finished;
934934
} quarter_state;
935935

936-
void
936+
static void
937937
quarter_init(quarter_state *s, int32_t a, int32_t b) {
938938
if (a < 0 || b < 0) {
939939
s->finished = 1;
@@ -953,12 +953,12 @@ quarter_init(quarter_state *s, int32_t a, int32_t b) {
953953

954954
// deviation of the point from ellipse curve, basically a substitution
955955
// of the point into the ellipse equation
956-
int64_t
956+
static int64_t
957957
quarter_delta(quarter_state *s, int64_t x, int64_t y) {
958958
return llabs(s->a2 * y * y + s->b2 * x * x - s->a2b2);
959959
}
960960

961-
int8_t
961+
static int8_t
962962
quarter_next(quarter_state *s, int32_t *ret_x, int32_t *ret_y) {
963963
if (s->finished) {
964964
return -1;
@@ -1009,7 +1009,7 @@ typedef struct {
10091009
int8_t leftmost;
10101010
} ellipse_state;
10111011

1012-
void
1012+
static void
10131013
ellipse_init(ellipse_state *s, int32_t a, int32_t b, int32_t w) {
10141014
s->bufcnt = 0;
10151015
s->leftmost = a % 2;
@@ -1023,7 +1023,7 @@ ellipse_init(ellipse_state *s, int32_t a, int32_t b, int32_t w) {
10231023
}
10241024
}
10251025

1026-
int8_t
1026+
static int8_t
10271027
ellipse_next(ellipse_state *s, int32_t *ret_x0, int32_t *ret_y, int32_t *ret_x1) {
10281028
if (s->bufcnt == 0) {
10291029
if (s->finished) {
@@ -1106,7 +1106,7 @@ typedef struct event_list {
11061106
} event_list;
11071107

11081108
// Mirrors all the clipping nodes of the tree relative to the y = x line.
1109-
void
1109+
static void
11101110
clip_tree_transpose(clip_node *root) {
11111111
if (root != NULL) {
11121112
if (root->type == CT_CLIP) {
@@ -1123,7 +1123,7 @@ clip_tree_transpose(clip_node *root) {
11231123
// non-intersecting segments sorted by X coordinate.
11241124
// Combining nodes (AND, OR) may also accept sequences for intersecting
11251125
// segments, i.e. something like correct bracket sequences.
1126-
int
1126+
static int
11271127
clip_tree_do_clip(
11281128
clip_node *root, int32_t x0, int32_t y, int32_t x1, event_list **ret
11291129
) {
@@ -1267,7 +1267,7 @@ typedef void (*clip_ellipse_init)(
12671267
);
12681268

12691269
// Resulting angles will satisfy 0 <= al < 360, al <= ar <= al + 360
1270-
void
1270+
static void
12711271
normalize_angles(float *al, float *ar) {
12721272
if (*ar - *al >= 360) {
12731273
*al = 0;
@@ -1279,7 +1279,7 @@ normalize_angles(float *al, float *ar) {
12791279
}
12801280

12811281
// An arc with caps orthogonal to the ellipse curve.
1282-
void
1282+
static void
12831283
arc_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float ar) {
12841284
if (a < b) {
12851285
// transpose the coordinate system
@@ -1349,7 +1349,7 @@ arc_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float
13491349
}
13501350

13511351
// A chord line.
1352-
void
1352+
static void
13531353
chord_line_init(
13541354
clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float ar
13551355
) {
@@ -1377,7 +1377,7 @@ chord_line_init(
13771377
}
13781378

13791379
// Pie side.
1380-
void
1380+
static void
13811381
pie_side_init(
13821382
clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float _
13831383
) {
@@ -1422,7 +1422,7 @@ pie_side_init(
14221422
}
14231423

14241424
// A chord.
1425-
void
1425+
static void
14261426
chord_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float ar) {
14271427
ellipse_init(&s->st, a, b, w);
14281428

@@ -1441,7 +1441,7 @@ chord_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, flo
14411441
}
14421442

14431443
// A pie. Can also be used to draw an arc with ugly sharp caps.
1444-
void
1444+
static void
14451445
pie_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float ar) {
14461446
ellipse_init(&s->st, a, b, w);
14471447

@@ -1485,7 +1485,7 @@ pie_init(clip_ellipse_state *s, int32_t a, int32_t b, int32_t w, float al, float
14851485
}
14861486
}
14871487

1488-
void
1488+
static void
14891489
clip_ellipse_free(clip_ellipse_state *s) {
14901490
while (s->head != NULL) {
14911491
event_list *t = s->head;
@@ -1494,7 +1494,7 @@ clip_ellipse_free(clip_ellipse_state *s) {
14941494
}
14951495
}
14961496

1497-
int8_t
1497+
static int8_t
14981498
clip_ellipse_next(
14991499
clip_ellipse_state *s, int32_t *ret_x0, int32_t *ret_y, int32_t *ret_x1
15001500
) {

src/libImaging/Filter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ ImagingExpand(Imaging imIn, int margin) {
106106
return imOut;
107107
}
108108

109+
// Deliberately not static: looks like GCC inlining this may be slower.
109110
float
110111
kernel_i16(int size, UINT8 *in0, int x, const float *kernel, int bigendian) {
111112
int i;

src/libImaging/Geometry.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ getfilter(Imaging im, int filterid) {
763763

764764
/* transformation engines */
765765

766-
Imaging
766+
static Imaging
767767
ImagingGenericTransform(
768768
Imaging imOut,
769769
Imaging imIn,
@@ -1006,7 +1006,7 @@ affine_fixed(
10061006
return imOut;
10071007
}
10081008

1009-
Imaging
1009+
static Imaging
10101010
ImagingTransformAffine(
10111011
Imaging imOut,
10121012
Imaging imIn,

src/libImaging/Histo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ImagingHistogramDelete(ImagingHistogram h) {
3434
}
3535
}
3636

37-
ImagingHistogram
37+
static ImagingHistogram
3838
ImagingHistogramNew(Imaging im) {
3939
ImagingHistogram h;
4040

src/libImaging/JpegDecode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
9595
}
9696
}
9797

98-
GLOBAL(void)
99-
jpeg_buffer_src(j_decompress_ptr cinfo, JPEGSOURCE *source) {
98+
static GLOBAL(void) jpeg_buffer_src(j_decompress_ptr cinfo, JPEGSOURCE *source) {
10099
cinfo->src = (void *)source;
101100

102101
/* Prepare for suspending reader */

src/libImaging/JpegEncode.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ empty_output_buffer(j_compress_ptr cinfo) {
4747
return FALSE;
4848
}
4949

50-
GLOBAL(void)
51-
jpeg_buffer_dest(j_compress_ptr cinfo, JPEGDESTINATION *destination) {
50+
static GLOBAL(void) jpeg_buffer_dest(
51+
j_compress_ptr cinfo, JPEGDESTINATION *destination
52+
) {
5253
cinfo->dest = (void *)destination;
5354

5455
destination->pub.init_destination = stub;

src/libImaging/Mode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <stdlib.h>
77
#endif
88

9-
const ModeData MODES[] = {
9+
static const ModeData MODES[] = {
1010
[IMAGING_MODE_UNKNOWN] = {""},
1111

1212
[IMAGING_MODE_1] = {"1"}, [IMAGING_MODE_CMYK] = {"CMYK"},
@@ -48,7 +48,7 @@ getModeData(const ModeID id) {
4848
return &MODES[id];
4949
}
5050

51-
const RawModeData RAWMODES[] = {
51+
static const RawModeData RAWMODES[] = {
5252
[IMAGING_RAWMODE_UNKNOWN] = {""},
5353

5454
[IMAGING_RAWMODE_1] = {"1"},

src/libImaging/Pack.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ packLAL(UINT8 *out, const UINT8 *in, int pixels) {
254254
}
255255
}
256256

257-
void
257+
static void
258258
ImagingPackRGB(UINT8 *out, const UINT8 *in, int pixels) {
259259
int i = 0;
260260
/* RGB triplets */
@@ -270,7 +270,7 @@ ImagingPackRGB(UINT8 *out, const UINT8 *in, int pixels) {
270270
}
271271
}
272272

273-
void
273+
static void
274274
ImagingPackXRGB(UINT8 *out, const UINT8 *in, int pixels) {
275275
int i;
276276
/* XRGB, triplets with left padding */
@@ -284,6 +284,7 @@ ImagingPackXRGB(UINT8 *out, const UINT8 *in, int pixels) {
284284
}
285285
}
286286

287+
// Used by Dib.c, hence not static.
287288
void
288289
ImagingPackBGR(UINT8 *out, const UINT8 *in, int pixels) {
289290
int i;
@@ -297,7 +298,7 @@ ImagingPackBGR(UINT8 *out, const UINT8 *in, int pixels) {
297298
}
298299
}
299300

300-
void
301+
static void
301302
ImagingPackBGRX(UINT8 *out, const UINT8 *in, int pixels) {
302303
int i;
303304
/* BGRX, reversed bytes with right padding */
@@ -311,7 +312,7 @@ ImagingPackBGRX(UINT8 *out, const UINT8 *in, int pixels) {
311312
}
312313
}
313314

314-
void
315+
static void
315316
ImagingPackXBGR(UINT8 *out, const UINT8 *in, int pixels) {
316317
int i;
317318
/* XBGR, reversed bytes with left padding */
@@ -325,7 +326,7 @@ ImagingPackXBGR(UINT8 *out, const UINT8 *in, int pixels) {
325326
}
326327
}
327328

328-
void
329+
static void
329330
ImagingPackCMYK2RGB(UINT8 *out, const UINT8 *in, int xsize) {
330331
int x, nk, tmp;
331332
for (x = 0; x < xsize; x++) {
@@ -338,7 +339,7 @@ ImagingPackCMYK2RGB(UINT8 *out, const UINT8 *in, int xsize) {
338339
}
339340
}
340341

341-
void
342+
static void
342343
ImagingPackBGRA(UINT8 *out, const UINT8 *in, int pixels) {
343344
int i;
344345
/* BGRA, reversed bytes with right alpha */
@@ -352,7 +353,7 @@ ImagingPackBGRA(UINT8 *out, const UINT8 *in, int pixels) {
352353
}
353354
}
354355

355-
void
356+
static void
356357
ImagingPackABGR(UINT8 *out, const UINT8 *in, int pixels) {
357358
int i;
358359
/* ABGR, reversed bytes with left alpha */
@@ -366,7 +367,7 @@ ImagingPackABGR(UINT8 *out, const UINT8 *in, int pixels) {
366367
}
367368
}
368369

369-
void
370+
static void
370371
ImagingPackBGRa(UINT8 *out, const UINT8 *in, int pixels) {
371372
int i;
372373
/* BGRa, reversed bytes with premultiplied alpha */
@@ -459,7 +460,7 @@ packI32S(UINT8 *out, const UINT8 *in, int pixels) {
459460
}
460461
}
461462

462-
void
463+
static void
463464
ImagingPackLAB(UINT8 *out, const UINT8 *in, int pixels) {
464465
int i;
465466
/* LAB triplets */

0 commit comments

Comments
 (0)