Skip to content

Commit 4206487

Browse files
committed
rename to AP_ARRAY_LEN
1 parent 421f8c1 commit 4206487

24 files changed

+47
-47
lines changed

include/ap_config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@
261261
#define AP_FN_ATTR_NONNULL(x)
262262
#endif
263263

264-
#ifndef ARRAY_LEN
264+
#ifndef AP_ARRAY_LEN
265265
/**
266-
* @def ARRAY_LEN(a)
266+
* @def AP_ARRAY_LEN(a)
267267
* @brief Computes the number of elements in a static array.
268268
*
269269
* This macro replaces `sizeof(a)/sizeof(a[0])` to improve readability.
@@ -273,6 +273,6 @@
273273
* @param a The static array.
274274
* @return The number of elements in the array.
275275
*/
276-
#define ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0]))
276+
#define AP_ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0]))
277277
#endif
278278
#endif /* AP_CONFIG_H */

modules/filters/sed1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ apr_status_t sed_reset_eval(sed_eval_t *eval, sed_commands_t *commands, sed_err_
331331
eval->hspend = eval->holdbuf;
332332
eval->lcomend = &eval->genbuf[71];
333333

334-
for (i = 0; i < ARRAY_LEN(eval->abuf); i++)
334+
for (i = 0; i < AP_ARRAY_LEN(eval->abuf); i++)
335335
eval->abuf[i] = NULL;
336336
eval->aptr = eval->abuf;
337337
eval->pending = NULL;

modules/http2/h2_bucket_beam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static int h2_blist_count(h2_blist *blist)
7474
do { \
7575
if (APLOG_C_IS_LEVEL((c),(level))) { \
7676
char buffer[4 * 1024]; \
77-
apr_size_t len, bmax = ARRAY_LEN(buffer); \
77+
apr_size_t len, bmax = AP_ARRAY_LEN(buffer); \
7878
len = bb? h2_util_bb_print(buffer, bmax, "", "", bb) : 0; \
7979
ap_log_cerror(APLOG_MARK, (level), rv, (c), \
8080
"BEAM[%s,%s%sdata=%ld,buckets(send/consumed)=%d/%d]: %s %s", \

modules/http2/h2_c1_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static void h2_c1_io_bb_log(conn_rec *c, int stream_id, int level,
6363
{
6464
char buffer[16 * 1024];
6565
const char *line = "(null)";
66-
int bmax = ARRAY_LEN(buffer);
66+
int bmax = AP_ARRAY_LEN(buffer);
6767
int off = 0;
6868
apr_bucket *b;
6969

modules/http2/h2_c2_filter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ apr_status_t h2_c2_filter_request_in(ap_filter_t *f,
154154
do { \
155155
if (APLOG_C_IS_LEVEL((c),(level))) { \
156156
char buffer[4 * 1024]; \
157-
apr_size_t len, bmax = ARRAY_LEN(buffer); \
157+
apr_size_t len, bmax = AP_ARRAY_LEN(buffer); \
158158
len = h2_util_bb_print(buffer, bmax, "", "", (bb)); \
159159
ap_log_cerror(APLOG_MARK, (level), rv, (c), \
160160
"FILTER[%s]: %s %s", \
@@ -800,7 +800,7 @@ static void make_chunk(conn_rec *c, h2_chunk_filter_t *fctx, apr_bucket_brigade
800800
apr_bucket *b;
801801
apr_size_t len;
802802

803-
len = (apr_size_t)apr_snprintf(buffer, ARRAY_LEN(buffer),
803+
len = (apr_size_t)apr_snprintf(buffer, AP_ARRAY_LEN(buffer),
804804
"%"APR_UINT64_T_HEX_FMT"\r\n", (apr_uint64_t)chunk_len);
805805
b = apr_bucket_heap_create(buffer, len, NULL, bb->bucket_alloc);
806806
APR_BUCKET_INSERT_BEFORE(first, b);

modules/http2/h2_protocol.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static const char *h2_err_descr[] = {
7777

7878
const char *h2_protocol_err_description(unsigned int h2_error)
7979
{
80-
if (h2_error < (ARRAY_LEN(h2_err_descr))) {
80+
if (h2_error < (AP_ARRAY_LEN(h2_err_descr))) {
8181
return h2_err_descr[h2_error];
8282
}
8383
return "unknown http/2 error code";
@@ -395,7 +395,7 @@ static const char *RFC7540_names[] = {
395395
"SSL3_CK_SCSV", /* TLS_EMPTY_RENEGOTIATION_INFO_SCSV */
396396
"SSL3_CK_FALLBACK_SCSV"
397397
};
398-
static size_t RFC7540_names_LEN = ARRAY_LEN(RFC7540_names);
398+
static size_t RFC7540_names_LEN = AP_ARRAY_LEN(RFC7540_names);
399399

400400

401401
static apr_hash_t *BLCNames;

modules/http2/h2_proxy_session.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static int on_frame_recv(nghttp2_session *ngh2, const nghttp2_frame *frame,
265265
if (APLOGcdebug(session->c)) {
266266
char buffer[256];
267267

268-
h2_proxy_util_frame_print(frame, buffer, ARRAY_LEN(buffer));
268+
h2_proxy_util_frame_print(frame, buffer, AP_ARRAY_LEN(buffer));
269269
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03341)
270270
"h2_proxy_session(%s): recv FRAME[%s]",
271271
session->id, buffer);
@@ -343,7 +343,7 @@ static int before_frame_send(nghttp2_session *ngh2,
343343
if (APLOGcdebug(session->c)) {
344344
char buffer[256];
345345

346-
h2_proxy_util_frame_print(frame, buffer, ARRAY_LEN(buffer));
346+
h2_proxy_util_frame_print(frame, buffer, AP_ARRAY_LEN(buffer));
347347
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03343)
348348
"h2_proxy_session(%s): sent FRAME[%s]",
349349
session->id, buffer);
@@ -801,7 +801,7 @@ static apr_status_t session_start(h2_proxy_session *session)
801801
settings[1].value = (1 << session->window_bits_stream) - 1;
802802

803803
rv = nghttp2_submit_settings(session->ngh2, NGHTTP2_FLAG_NONE, settings,
804-
ARRAY_LEN(settings));
804+
AP_ARRAY_LEN(settings));
805805

806806
/* If the connection window is larger than our default, trigger a WINDOW_UPDATE */
807807
add_conn_window = ((1 << session->window_bits_connection) - 1 -

modules/http2/h2_proxy_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ typedef struct {
478478
} literal;
479479

480480
#define H2_DEF_LITERAL(n) { (n), (sizeof(n)-1) }
481-
#define H2_LIT_ARGS(a) (a),ARRAY_LEN(a)
481+
#define H2_LIT_ARGS(a) (a),AP_ARRAY_LEN(a)
482482

483483
static literal IgnoredRequestHeaders[] = {
484484
H2_DEF_LITERAL("upgrade"),

modules/http2/h2_session.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static int on_invalid_frame_recv_cb(nghttp2_session *ngh2,
219219
if (APLOGcdebug(session->c1)) {
220220
char buffer[256];
221221

222-
h2_util_frame_print(frame, buffer, ARRAY_LEN(buffer));
222+
h2_util_frame_print(frame, buffer, AP_ARRAY_LEN(buffer));
223223
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1,
224224
H2_SSSN_LOG(APLOGNO(03063), session,
225225
"recv invalid FRAME[%s], frames=%ld/%ld (r/s)"),
@@ -352,7 +352,7 @@ static int on_frame_recv_cb(nghttp2_session *ng2s,
352352
if (APLOGcdebug(session->c1)) {
353353
char buffer[256];
354354

355-
h2_util_frame_print(frame, buffer, ARRAY_LEN(buffer));
355+
h2_util_frame_print(frame, buffer, AP_ARRAY_LEN(buffer));
356356
if (stream) {
357357
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1,
358358
H2_STRM_LOG(APLOGNO(10302), stream,
@@ -450,7 +450,7 @@ static int on_frame_recv_cb(nghttp2_session *ng2s,
450450
char buffer[256];
451451

452452
h2_util_frame_print(frame, buffer,
453-
ARRAY_LEN(buffer));
453+
AP_ARRAY_LEN(buffer));
454454
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c1,
455455
H2_SSSN_MSG(session, "on_frame_rcv %s"), buffer);
456456
}
@@ -600,7 +600,7 @@ static int on_frame_send_cb(nghttp2_session *ngh2,
600600
if (APLOGcdebug(session->c1)) {
601601
char buffer[256];
602602

603-
h2_util_frame_print(frame, buffer, ARRAY_LEN(buffer));
603+
h2_util_frame_print(frame, buffer, AP_ARRAY_LEN(buffer));
604604
if (stream) {
605605
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1,
606606
H2_STRM_LOG(APLOGNO(10303), stream,
@@ -635,7 +635,7 @@ static int on_frame_not_send_cb(nghttp2_session *ngh2,
635635
char buffer[256];
636636

637637
stream = get_stream(session, stream_id);
638-
h2_util_frame_print(frame, buffer, ARRAY_LEN(buffer));
638+
h2_util_frame_print(frame, buffer, AP_ARRAY_LEN(buffer));
639639
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, session->c1,
640640
H2_SSSN_LOG(APLOGNO(), session,
641641
"not sent FRAME[%s], error %d: %s"),

modules/http2/h2_stream.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ static int on_frame(h2_stream_state_t state, int frame_type,
156156

157157
static int on_frame_send(h2_stream_state_t state, int frame_type)
158158
{
159-
return on_frame(state, frame_type, trans_on_send, ARRAY_LEN(trans_on_send));
159+
return on_frame(state, frame_type, trans_on_send, AP_ARRAY_LEN(trans_on_send));
160160
}
161161

162162
static int on_frame_recv(h2_stream_state_t state, int frame_type)
163163
{
164-
return on_frame(state, frame_type, trans_on_recv, ARRAY_LEN(trans_on_recv));
164+
return on_frame(state, frame_type, trans_on_recv, AP_ARRAY_LEN(trans_on_recv));
165165
}
166166

167167
static int on_event(h2_stream* stream, h2_stream_event_t ev)
@@ -170,7 +170,7 @@ static int on_event(h2_stream* stream, h2_stream_event_t ev)
170170
if (stream->monitor && stream->monitor->on_event) {
171171
stream->monitor->on_event(stream->monitor->ctx, stream, ev);
172172
}
173-
if (ev < ARRAY_LEN(trans_on_event)) {
173+
if (ev < AP_ARRAY_LEN(trans_on_event)) {
174174
return on_map(stream->state, trans_on_event[ev]);
175175
}
176176
return stream->state;
@@ -189,7 +189,7 @@ static void H2_STREAM_OUT_LOG(int lvl, h2_stream *s, const char *tag)
189189
if (APLOG_C_IS_LEVEL(s->session->c1, lvl)) {
190190
conn_rec *c = s->session->c1;
191191
char buffer[4 * 1024];
192-
apr_size_t len, bmax = ARRAY_LEN(buffer);
192+
apr_size_t len, bmax = AP_ARRAY_LEN(buffer);
193193

194194
len = h2_util_bb_print(buffer, bmax, tag, "", s->out_buffer);
195195
ap_log_cerror(APLOG_MARK, lvl, 0, c,

0 commit comments

Comments
 (0)