Skip to content

Commit 5ac084d

Browse files
committed
Apply style-fix
1 parent 42e3e84 commit 5ac084d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+427
-446
lines changed

examples/consumer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
/* Typical include path would be <librdkafka/rdkafka.h>, but this program
4343
* is builtin from within the librdkafka source tree and thus differs. */
44-
//#include <librdkafka/rdkafka.h>
44+
// #include <librdkafka/rdkafka.h>
4545
#include "rdkafka.h"
4646

4747

examples/incremental_alter_configs.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,10 @@ cmd_incremental_alter_configs(rd_kafka_conf_t *conf, int argc, char **argv) {
183183
rd_kafka_ConfigResource_t *config;
184184
rd_kafka_AlterConfigOpType_t op_type;
185185
rd_kafka_ResourceType_t restype =
186-
!strcmp(restype_s, "TOPIC")
187-
? RD_KAFKA_RESOURCE_TOPIC
188-
: !strcmp(restype_s, "BROKER")
189-
? RD_KAFKA_RESOURCE_BROKER
190-
: !strcmp(restype_s, "GROUP")
191-
? RD_KAFKA_RESOURCE_GROUP
192-
: RD_KAFKA_RESOURCE_UNKNOWN;
186+
!strcmp(restype_s, "TOPIC") ? RD_KAFKA_RESOURCE_TOPIC
187+
: !strcmp(restype_s, "BROKER") ? RD_KAFKA_RESOURCE_BROKER
188+
: !strcmp(restype_s, "GROUP") ? RD_KAFKA_RESOURCE_GROUP
189+
: RD_KAFKA_RESOURCE_UNKNOWN;
193190

194191
if (restype == RD_KAFKA_RESOURCE_UNKNOWN) {
195192
usage("Invalid resource type: %s", restype_s);

examples/kafkatest_verifiable_client.cpp

Lines changed: 26 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,11 @@ static void errorString(const std::string &name,
194194
const std::string &topic,
195195
const std::string *key,
196196
const std::string &value) {
197-
std::cout << "{ "
198-
<< "\"name\": \"" << name << "\", "
199-
<< "\"_time\": \"" << now() << "\", "
200-
<< "\"message\": \"" << errmsg << "\", "
201-
<< "\"topic\": \"" << topic << "\", "
202-
<< "\"key\": \"" << (key ? *key : "NULL") << "\", "
203-
<< "\"value\": \"" << value << "\" "
204-
<< "}" << std::endl;
197+
std::cout << "{ " << "\"name\": \"" << name << "\", " << "\"_time\": \""
198+
<< now() << "\", " << "\"message\": \"" << errmsg << "\", "
199+
<< "\"topic\": \"" << topic << "\", " << "\"key\": \""
200+
<< (key ? *key : "NULL") << "\", " << "\"value\": \"" << value
201+
<< "\" " << "}" << std::endl;
205202
}
206203

207204

@@ -211,15 +208,12 @@ static void successString(const std::string &name,
211208
int64_t offset,
212209
const std::string *key,
213210
const std::string &value) {
214-
std::cout << "{ "
215-
<< "\"name\": \"" << name << "\", "
216-
<< "\"_time\": \"" << now() << "\", "
217-
<< "\"topic\": \"" << topic << "\", "
211+
std::cout << "{ " << "\"name\": \"" << name << "\", " << "\"_time\": \""
212+
<< now() << "\", " << "\"topic\": \"" << topic << "\", "
218213
<< "\"partition\": " << partition << ", "
219-
<< "\"offset\": " << offset << ", "
220-
<< "\"key\": \"" << (key ? *key : "NULL") << "\", "
221-
<< "\"value\": \"" << value << "\" "
222-
<< "}" << std::endl;
214+
<< "\"offset\": " << offset << ", " << "\"key\": \""
215+
<< (key ? *key : "NULL") << "\", " << "\"value\": \"" << value
216+
<< "\" " << "}" << std::endl;
223217
}
224218

225219

@@ -231,15 +225,11 @@ static void offsetStatus(bool success,
231225
const std::string &errstr) {
232226
std::cout << "{ "
233227
"\"name\": \"offsets_committed\", "
234-
<< "\"success\": " << success << ", "
235-
<< "\"offsets\": [ "
236-
<< " { "
228+
<< "\"success\": " << success << ", " << "\"offsets\": [ " << " { "
237229
<< " \"topic\": \"" << topic << "\", "
238230
<< " \"partition\": " << partition << ", "
239-
<< " \"offset\": " << (int)offset << ", "
240-
<< " \"error\": \"" << errstr << "\" "
241-
<< " } "
242-
<< "] }" << std::endl;
231+
<< " \"offset\": " << (int)offset << ", " << " \"error\": \""
232+
<< errstr << "\" " << " } " << "] }" << std::endl;
243233
}
244234
#endif
245235

@@ -341,8 +331,7 @@ static void report_records_consumed(int immediate) {
341331
<< "\"count\": "
342332
<< (state.consumer.consumedMessages -
343333
state.consumer.consumedMessagesLastReported)
344-
<< ", "
345-
<< "\"partitions\": [ ";
334+
<< ", " << "\"partitions\": [ ";
346335

347336
for (std::map<std::string, Assignment>::iterator ii = assignments->begin();
348337
ii != assignments->end(); ii++) {
@@ -352,8 +341,7 @@ static void report_records_consumed(int immediate) {
352341
<< " \"topic\": \"" << a->topic << "\", "
353342
<< " \"partition\": " << a->partition << ", "
354343
<< " \"minOffset\": " << a->minOffset << ", "
355-
<< " \"maxOffset\": " << a->maxOffset << " "
356-
<< " } ";
344+
<< " \"maxOffset\": " << a->maxOffset << " " << " } ";
357345
a->minOffset = -1;
358346
}
359347

@@ -378,24 +366,22 @@ class ExampleOffsetCommitCb : public RdKafka::OffsetCommitCb {
378366
*/
379367
report_records_consumed(1);
380368

381-
std::cout << "{ "
382-
<< "\"name\": \"offsets_committed\", "
369+
std::cout << "{ " << "\"name\": \"offsets_committed\", "
383370
<< "\"success\": " << (err ? "false" : "true") << ", "
384371
<< "\"error\": \"" << (err ? RdKafka::err2str(err) : "") << "\", "
385372
<< "\"_autocommit\": "
386373
<< (state.consumer.useAutoCommit ? "true" : "false") << ", "
387374
<< "\"offsets\": [ ";
388375
assert(offsets.size() > 0);
389376
for (unsigned int i = 0; i < offsets.size(); i++) {
390-
std::cout << (i == 0 ? "" : ", ") << "{ "
391-
<< " \"topic\": \"" << offsets[i]->topic() << "\", "
377+
std::cout << (i == 0 ? "" : ", ") << "{ " << " \"topic\": \""
378+
<< offsets[i]->topic() << "\", "
392379
<< " \"partition\": " << offsets[i]->partition() << ", "
393380
<< " \"offset\": " << (int)offsets[i]->offset() << ", "
394381
<< " \"error\": \""
395382
<< (offsets[i]->err() ? RdKafka::err2str(offsets[i]->err())
396383
: "")
397-
<< "\" "
398-
<< " }";
384+
<< "\" " << " }";
399385
}
400386
std::cout << " ] }" << std::endl;
401387
}
@@ -427,8 +413,8 @@ static void do_commit(RdKafka::KafkaConsumer *consumer, int immediate) {
427413
RdKafka::ErrorCode err;
428414
err = consumer->commitSync(&ex_offset_commit_cb);
429415

430-
std::cerr << now() << ": "
431-
<< "sync commit returned " << RdKafka::err2str(err) << std::endl;
416+
std::cerr << now() << ": " << "sync commit returned " << RdKafka::err2str(err)
417+
<< std::endl;
432418

433419
state.consumer.consumedMessagesAtLastCommit = state.consumer.consumedMessages;
434420
}
@@ -526,8 +512,8 @@ class ExampleRebalanceCb : public RdKafka::RebalanceCb {
526512
const std::vector<RdKafka::TopicPartition *> &partitions) {
527513
std::ostringstream out;
528514
for (unsigned int i = 0; i < partitions.size(); i++)
529-
out << (i == 0 ? "" : ", ") << "{ "
530-
<< " \"topic\": \"" << partitions[i]->topic() << "\", "
515+
out << (i == 0 ? "" : ", ") << "{ " << " \"topic\": \""
516+
<< partitions[i]->topic() << "\", "
531517
<< " \"partition\": " << partitions[i]->partition() << " }";
532518
return out.str();
533519
}
@@ -549,13 +535,11 @@ class ExampleRebalanceCb : public RdKafka::RebalanceCb {
549535
consumer->unassign();
550536
}
551537

552-
std::cout << "{ "
553-
<< "\"name\": \"partitions_"
538+
std::cout << "{ " << "\"name\": \"partitions_"
554539
<< (err == RdKafka::ERR__ASSIGN_PARTITIONS ? "assigned"
555540
: "revoked")
556-
<< "\", "
557-
<< "\"partitions\": [ " << part_list_json(partitions) << "] }"
558-
<< std::endl;
541+
<< "\", " << "\"partitions\": [ " << part_list_json(partitions)
542+
<< "] }" << std::endl;
559543
}
560544
};
561545

examples/openssl_engine_example.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ class PrintingSSLVerifyCb : public RdKafka::SslCertificateVerifyCb {
7474
const char *buf,
7575
size_t size,
7676
std::string &errstr) {
77-
std::cout << "ssl_cert_verify_cb :"
78-
<< ": broker_name=" << broker_name << ", broker_id=" << broker_id
79-
<< ", x509_error=" << *x509_error << ", depth=" << depth
80-
<< ", buf size=" << size << std::endl;
77+
std::cout << "ssl_cert_verify_cb :" << ": broker_name=" << broker_name
78+
<< ", broker_id=" << broker_id << ", x509_error=" << *x509_error
79+
<< ", depth=" << depth << ", buf size=" << size << std::endl;
8180

8281
return true;
8382
}

examples/producer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ int main(int argc, char **argv) {
133133
/*
134134
* Read messages from stdin and produce to broker.
135135
*/
136-
std::cout << "% Type message value and hit enter "
137-
<< "to produce message." << std::endl;
136+
std::cout << "% Type message value and hit enter " << "to produce message."
137+
<< std::endl;
138138

139139
for (std::string line; run && std::getline(std::cin, line);) {
140140
if (line.empty()) {

examples/user_scram.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,10 @@ int64_t parse_int(const char *what, const char *str) {
138138
}
139139

140140
rd_kafka_ScramMechanism_t parse_mechanism(const char *arg) {
141-
return !strcmp(arg, "SCRAM-SHA-256")
142-
? RD_KAFKA_SCRAM_MECHANISM_SHA_256
143-
: !strcmp(arg, "SCRAM-SHA-512")
144-
? RD_KAFKA_SCRAM_MECHANISM_SHA_512
145-
: RD_KAFKA_SCRAM_MECHANISM_UNKNOWN;
141+
return !strcmp(arg, "SCRAM-SHA-256") ? RD_KAFKA_SCRAM_MECHANISM_SHA_256
142+
: !strcmp(arg, "SCRAM-SHA-512")
143+
? RD_KAFKA_SCRAM_MECHANISM_SHA_512
144+
: RD_KAFKA_SCRAM_MECHANISM_UNKNOWN;
146145
}
147146

148147
static void print_descriptions(

examples/win_ssl_cert_store.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ class PrintingSSLVerifyCb : public RdKafka::SslCertificateVerifyCb {
211211
CertGetNameStringA(ctx, CERT_NAME_FRIENDLY_DISPLAY_TYPE,
212212
CERT_NAME_ISSUER_FLAG, NULL, issuer, sizeof(issuer));
213213

214-
std::cerr << "Broker " << broker_name << " (" << broker_id << "): "
215-
<< "certificate depth " << depth << ", X509 error " << *x509_error
216-
<< ", subject " << subject << ", issuer " << issuer << std::endl;
214+
std::cerr << "Broker " << broker_name << " (" << broker_id
215+
<< "): " << "certificate depth " << depth << ", X509 error "
216+
<< *x509_error << ", subject " << subject << ", issuer " << issuer
217+
<< std::endl;
217218

218219
if (ctx)
219220
CertFreeCertificateContext(ctx);

src/rd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static RD_INLINE RD_UNUSED char *rd_strndup(const char *s, size_t len) {
220220

221221

222222
/* Round/align X upwards to STRIDE, which must be power of 2. */
223-
#define RD_ROUNDUP(X, STRIDE) (((X) + ((STRIDE)-1)) & ~(STRIDE - 1))
223+
#define RD_ROUNDUP(X, STRIDE) (((X) + ((STRIDE) - 1)) & ~(STRIDE - 1))
224224

225225
#define RD_ARRAY_SIZE(A) (sizeof((A)) / sizeof(*(A)))
226226
#define RD_ARRAYSIZE(A) RD_ARRAY_SIZE(A)
@@ -427,7 +427,7 @@ static RD_INLINE RD_UNUSED int rd_refcnt_get(rd_refcnt_t *R) {
427427

428428
#define RD_INTERFACE_CALL(i, name, ...) (i->name(i->opaque, __VA_ARGS__))
429429

430-
#define RD_CEIL_INTEGER_DIVISION(X, DEN) (((X) + ((DEN)-1)) / (DEN))
430+
#define RD_CEIL_INTEGER_DIVISION(X, DEN) (((X) + ((DEN) - 1)) / (DEN))
431431

432432
/**
433433
* @brief Utility types to hold memory,size tuple.

src/rdaddr.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,13 @@ typedef union {
5454
#define sinx_family in.sin_family
5555
#define sinx_addr in.sin_addr
5656
#define RD_SOCKADDR_INX_LEN(sinx) \
57-
((sinx)->sinx_family == AF_INET \
58-
? sizeof(struct sockaddr_in) \
59-
: (sinx)->sinx_family == AF_INET6 ? sizeof(struct sockaddr_in6) \
60-
: sizeof(rd_sockaddr_inx_t))
57+
((sinx)->sinx_family == AF_INET ? sizeof(struct sockaddr_in) \
58+
: (sinx)->sinx_family == AF_INET6 ? sizeof(struct sockaddr_in6) \
59+
: sizeof(rd_sockaddr_inx_t))
6160
#define RD_SOCKADDR_INX_PORT(sinx) \
62-
((sinx)->sinx_family == AF_INET \
63-
? (sinx)->in.sin_port \
64-
: (sinx)->sinx_family == AF_INET6 ? (sinx)->in6.sin6_port : 0)
61+
((sinx)->sinx_family == AF_INET ? (sinx)->in.sin_port \
62+
: (sinx)->sinx_family == AF_INET6 ? (sinx)->in6.sin6_port \
63+
: 0)
6564

6665
#define RD_SOCKADDR_INX_PORT_SET(sinx, port) \
6766
do { \

src/rdavg.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ typedef struct rd_avg_s {
4545
} ra_v;
4646
mtx_t ra_lock;
4747
int ra_enabled;
48-
enum { RD_AVG_GAUGE,
49-
RD_AVG_COUNTER,
48+
enum {
49+
RD_AVG_GAUGE,
50+
RD_AVG_COUNTER,
5051
} ra_type;
5152
#if WITH_HDRHISTOGRAM
5253
rd_hdr_histogram_t *ra_hdr;

src/rdbase64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <openssl/ssl.h>
3333
#else
3434

35-
#define conv_bin2ascii(a, table) ((table)[(a)&0x3f])
35+
#define conv_bin2ascii(a, table) ((table)[(a) & 0x3f])
3636

3737
static const unsigned char data_bin2ascii[65] =
3838
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

src/rdendian.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,17 @@
125125
#define be32toh(x) (x)
126126
#define be16toh(x) (x)
127127
#define le32toh(x) \
128-
((((x)&0xff) << 24) | (((x)&0xff00) << 8) | (((x)&0xff0000) >> 8) | \
129-
(((x)&0xff000000) >> 24))
128+
((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | \
129+
(((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24))
130130
#define le64toh(x) \
131-
((((x)&0x00000000000000ffL) << 56) | \
132-
(((x)&0x000000000000ff00L) << 40) | \
133-
(((x)&0x0000000000ff0000L) << 24) | \
134-
(((x)&0x00000000ff000000L) << 8) | (((x)&0x000000ff00000000L) >> 8) | \
135-
(((x)&0x0000ff0000000000L) >> 24) | \
136-
(((x)&0x00ff000000000000L) >> 40) | \
137-
(((x)&0xff00000000000000L) >> 56))
131+
((((x) & 0x00000000000000ffL) << 56) | \
132+
(((x) & 0x000000000000ff00L) << 40) | \
133+
(((x) & 0x0000000000ff0000L) << 24) | \
134+
(((x) & 0x00000000ff000000L) << 8) | \
135+
(((x) & 0x000000ff00000000L) >> 8) | \
136+
(((x) & 0x0000ff0000000000L) >> 24) | \
137+
(((x) & 0x00ff000000000000L) >> 40) | \
138+
(((x) & 0xff00000000000000L) >> 56))
138139
#else
139140
#include <endian.h>
140141
#endif

src/rdkafka.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3978,8 +3978,8 @@ rd_kafka_op_res_t rd_kafka_poll_cb(rd_kafka_t *rk,
39783978
else {
39793979
rk->rk_ts_last_poll_end = rd_clock();
39803980
struct consume_ctx ctx = {.consume_cb =
3981-
rk->rk_conf.consume_cb,
3982-
.opaque = rk->rk_conf.opaque};
3981+
rk->rk_conf.consume_cb,
3982+
.opaque = rk->rk_conf.opaque};
39833983

39843984
return rd_kafka_consume_cb(rk, rkq, rko, cb_type, &ctx);
39853985
}

src/rdkafka.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3231,7 +3231,7 @@ void *rd_kafka_topic_opaque(const rd_kafka_topic_t *rkt);
32313231
* The unassigned partition is used by the producer API for messages
32323232
* that should be partitioned using the configured or default partitioner.
32333233
*/
3234-
#define RD_KAFKA_PARTITION_UA ((int32_t)-1)
3234+
#define RD_KAFKA_PARTITION_UA ((int32_t) - 1)
32353235

32363236

32373237
/**

src/rdkafka_admin.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,12 @@ static const char *rd_kafka_admin_state_desc[] = {
231231
* @enum Admin request target broker. Must be negative values since the field
232232
* used is broker_id.
233233
*/
234-
enum { RD_KAFKA_ADMIN_TARGET_CONTROLLER = -1, /**< Cluster controller */
235-
RD_KAFKA_ADMIN_TARGET_COORDINATOR = -2, /**< (Group) Coordinator */
236-
RD_KAFKA_ADMIN_TARGET_FANOUT = -3, /**< This rko is a fanout and
237-
* and has no target broker */
238-
RD_KAFKA_ADMIN_TARGET_ALL = -4, /**< All available brokers */
234+
enum {
235+
RD_KAFKA_ADMIN_TARGET_CONTROLLER = -1, /**< Cluster controller */
236+
RD_KAFKA_ADMIN_TARGET_COORDINATOR = -2, /**< (Group) Coordinator */
237+
RD_KAFKA_ADMIN_TARGET_FANOUT = -3, /**< This rko is a fanout and
238+
* and has no target broker */
239+
RD_KAFKA_ADMIN_TARGET_ALL = -4, /**< All available brokers */
239240
};
240241

241242
/**
@@ -2154,7 +2155,7 @@ rd_kafka_CreateTopicsResponse_parse(rd_kafka_op_t *rko_req,
21542155
* does not maintain ordering unfortunately. */
21552156
skel.topic = terr->topic;
21562157
orig_pos = rd_list_index(&rko_result->rko_u.admin_result.args,
2157-
&skel, rd_kafka_NewTopic_cmp);
2158+
&skel, rd_kafka_NewTopic_cmp);
21582159
if (orig_pos == -1) {
21592160
rd_kafka_topic_result_destroy(terr);
21602161
rd_kafka_buf_parse_fail(
@@ -2363,7 +2364,7 @@ rd_kafka_DeleteTopicsResponse_parse(rd_kafka_op_t *rko_req,
23632364
* does not maintain ordering unfortunately. */
23642365
skel.topic = terr->topic;
23652366
orig_pos = rd_list_index(&rko_result->rko_u.admin_result.args,
2366-
&skel, rd_kafka_DeleteTopic_cmp);
2367+
&skel, rd_kafka_DeleteTopic_cmp);
23672368
if (orig_pos == -1) {
23682369
rd_kafka_topic_result_destroy(terr);
23692370
rd_kafka_buf_parse_fail(
@@ -2648,7 +2649,7 @@ rd_kafka_CreatePartitionsResponse_parse(rd_kafka_op_t *rko_req,
26482649
* does not maintain ordering unfortunately. */
26492650
skel.topic = terr->topic;
26502651
orig_pos = rd_list_index(&rko_result->rko_u.admin_result.args,
2651-
&skel, rd_kafka_NewPartitions_cmp);
2652+
&skel, rd_kafka_NewPartitions_cmp);
26522653
if (orig_pos == -1) {
26532654
rd_kafka_topic_result_destroy(terr);
26542655
rd_kafka_buf_parse_fail(
@@ -7551,8 +7552,8 @@ rd_kafka_ListConsumerGroupsResponse_parse(rd_kafka_op_t *rko_req,
75517552
error = rd_kafka_error_new(
75527553
error_code,
75537554
"Broker [%d"
7554-
"] "
7555-
"ListConsumerGroups response protocol parse failure: %s",
7555+
"] "
7556+
"ListConsumerGroups response protocol parse failure: %s",
75567557
rd_kafka_broker_id(rkb), rd_kafka_err2str(error_code));
75577558
rd_list_add(&errors, error);
75587559
}

0 commit comments

Comments
 (0)