Skip to content

Commit

Permalink
test: remove unused longindex
Browse files Browse the repository at this point in the history
When parsing command line arguments with `getopt_long()`, longindex
output pointer can be `NULL` if it is not needed.

Signed-off-by: Tuomas Taipale <[email protected]>
Reviewed-by: Matias Elo <[email protected]>
  • Loading branch information
TuomasTaipale committed Jan 20, 2025
1 parent 9ce1998 commit a4918ab
Show file tree
Hide file tree
Showing 33 changed files with 44 additions and 66 deletions.
4 changes: 2 additions & 2 deletions test/miscellaneous/odp_dyn_workers.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static parse_result_t check_options(const global_config_t *config)

static parse_result_t parse_options(int argc, char **argv, global_config_t *config)
{
int opt, long_index;
int opt;

static const struct option longopts[] = {
{ "cpumasks", required_argument, NULL, 'c' },
Expand All @@ -361,7 +361,7 @@ static parse_result_t parse_options(int argc, char **argv, global_config_t *conf
init_options(config);

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_atomic_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,6 @@ static int output_summary(test_global_t *global)
static int parse_options(int argc, char *argv[], test_options_t *test_options)
{
int opt;
int long_index;
int ret = 0;

static const struct option longopts[] = {
Expand All @@ -1167,7 +1166,7 @@ static int parse_options(int argc, char *argv[], test_options_t *test_options)
test_options->private = 0;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_bench_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ static void usage(char *progname)
static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
{
int opt;
int long_index;
static const struct option longopts[] = {
{"burst", required_argument, NULL, 'b'},
{"cache_size", required_argument, NULL, 'c'},
Expand All @@ -609,7 +608,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->time = 0;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_bench_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,6 @@ static void usage(void)
static int parse_args(int argc, char *argv[])
{
int opt;
int long_index;
appl_args_t *appl_args = &gbl_args->appl;
static const struct option longopts[] = {
{"time", required_argument, NULL, 't'},
Expand All @@ -903,7 +902,7 @@ static int parse_args(int argc, char *argv[])
appl_args->rounds = ROUNDS;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_bench_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,6 @@ static void usage(char *progname)
static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
{
int opt;
int long_index;
static const struct option longopts[] = {
{"burst", required_argument, NULL, 'b'},
{"cache_size", required_argument, NULL, 'c'},
Expand All @@ -1576,7 +1575,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->time = 0;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_bench_pktio_sp.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,6 @@ static int parse_args(int argc, char *argv[])
{
int i;
int opt;
int long_index;
static const struct option longopts[] = {
{"interface", required_argument, NULL, 'i'},
{"in_mode", required_argument, NULL, 'm'},
Expand All @@ -901,7 +900,7 @@ static int parse_args(int argc, char *argv[])
gbl_args->opt.num_pmr = 1;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_bench_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ static void usage(void)
static int parse_args(int argc, char *argv[])
{
int opt;
int long_index;
static const struct option longopts[] = {
{"clk_src", required_argument, NULL, 's'},
{"time", required_argument, NULL, 't'},
Expand All @@ -353,7 +352,7 @@ static int parse_args(int argc, char *argv[])
gbl_args->opt.rounds = ROUNDS;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_cpu_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ static void usage(char *progname)
static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
{
int opt;
int long_index;

static const struct option longopts[] = {
{"accuracy", required_argument, NULL, 'a'},
Expand All @@ -396,7 +395,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->time = 10; /* Loop forever if time to run is 0 */

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ static void print_usage(void)
static int parse_options(int argc, char *argv[])
{
int opt;
int long_index;
int ret = 0;

static const struct option longopts[] = {
Expand All @@ -79,7 +78,7 @@ static int parse_options(int argc, char *argv[])
options = options_def;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,6 @@ int main(int argc, char *argv[])
static void parse_args(int argc, char *argv[], crypto_args_t *cargs)
{
int opt;
int long_index;
static const struct option longopts[] = {
{"algorithm", optional_argument, NULL, 'a'},
{"debug", no_argument, NULL, 'd'},
Expand All @@ -1410,7 +1409,7 @@ static void parse_args(int argc, char *argv[], crypto_args_t *cargs)
cargs->schedule = 0;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
4 changes: 2 additions & 2 deletions test/performance/odp_dma_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static parse_result_t check_options(prog_config_t *config)

static parse_result_t parse_options(int argc, char **argv, prog_config_t *config)
{
int opt, long_index;
int opt;
static const struct option longopts[] = {
{ "trs_type", required_argument, NULL, 't' },
{ "num_in_seg", required_argument, NULL, 'i' },
Expand All @@ -574,7 +574,7 @@ static parse_result_t parse_options(int argc, char **argv, prog_config_t *config
init_config(config);

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
4 changes: 2 additions & 2 deletions test/performance/odp_dmafwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ static parse_result_t check_options(prog_config_t *config)

static parse_result_t parse_options(int argc, char **argv, prog_config_t *config)
{
int opt, long_index;
int opt;

static const struct option longopts[] = {
{ "interfaces", required_argument, NULL, 'i' },
Expand All @@ -481,7 +481,7 @@ static parse_result_t parse_options(int argc, char **argv, prog_config_t *config
init_config(config);

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_icache_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -15468,7 +15468,6 @@ static void print_usage(void)
static int parse_options(int argc, char *argv[], test_global_t *global)
{
int opt;
int long_index;
test_options_t *test_options = &global->test_options;
int ret = 0;
uint32_t max_func = ODPH_ARRAY_SIZE(work_0);
Expand Down Expand Up @@ -15504,7 +15503,7 @@ static int parse_options(int argc, char *argv[], test_global_t *global)
test_options->pref_before = 0;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_ipsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,6 @@ static void usage(char *progname)
static void parse_args(int argc, char *argv[], ipsec_args_t *cargs)
{
int opt;
int long_index;
static const struct option longopts[] = {
{"algorithm", optional_argument, NULL, 'a'},
{"debug", no_argument, NULL, 'd'},
Expand Down Expand Up @@ -1088,7 +1087,7 @@ static void parse_args(int argc, char *argv[], ipsec_args_t *cargs)
cargs->ah = 0;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
4 changes: 2 additions & 2 deletions test/performance/odp_ipsecfwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@ static parse_result_t check_options(prog_config_t *config)

static parse_result_t parse_options(int argc, char **argv, prog_config_t *config)
{
int opt, long_index;
int opt;
config_t cfg;

static const struct option longopts[] = {
Expand All @@ -1489,7 +1489,7 @@ static parse_result_t parse_options(int argc, char **argv, prog_config_t *config
static const char *shortopts = "i:n:l:c:m:C:I:S:O:dh";

while (true) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_l2fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,6 @@ static void usage(char *progname)
static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
{
int opt;
int long_index;
char *token;
char *tmp_str, *tmp;
size_t str_len, len;
Expand Down Expand Up @@ -2051,7 +2050,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->flow_control = 0;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
4 changes: 2 additions & 2 deletions test/performance/odp_l2fwd_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static parse_result_t check_options(prog_config_t *config)

static parse_result_t parse_options(int argc, char **argv, prog_config_t *config)
{
int opt, long_index;
int opt;

static const struct option longopts[] = {
{ "interfaces", required_argument, NULL, 'i' },
Expand All @@ -396,7 +396,7 @@ static parse_result_t parse_options(int argc, char **argv, prog_config_t *config
init_config(config);

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_lock_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ static int output_summary(test_global_t *global)
static int parse_options(int argc, char *argv[], test_options_t *test_options)
{
int opt;
int long_index;
int ret = 0;

static const struct option longopts[] = {
Expand All @@ -348,7 +347,7 @@ static int parse_options(int argc, char *argv[], test_options_t *test_options)
*test_options = test_options_def;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_mem_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static void print_usage(void)
static int parse_options(int argc, char *argv[], test_options_t *test_options)
{
int opt;
int long_index;
int ret = 0;

static const struct option longopts[] = {
Expand All @@ -100,7 +99,7 @@ static int parse_options(int argc, char *argv[], test_options_t *test_options)
test_options->mode = 0;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
4 changes: 2 additions & 2 deletions test/performance/odp_packet_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ static int init_bins(test_global_t *global)

static int parse_options(int argc, char *argv[], test_global_t *global)
{
int opt, i, len, str_len, long_index, port;
int opt, i, len, str_len, port;
unsigned long int count;
uint32_t min_packets, num_tx_pkt, num_tx_alloc, pkt_len, req_len, val, bins;
char *name, *str, *end;
Expand Down Expand Up @@ -751,7 +751,7 @@ static int parse_options(int argc, char *argv[], test_global_t *global)
}

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_pktio_ordered.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,6 @@ static void usage(char *progname)
static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
{
int opt;
int long_index;
char *token;
char *addr_str;
size_t len;
Expand Down Expand Up @@ -885,7 +884,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->promisc_mode = 0;

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break; /* No more options */
Expand Down
3 changes: 1 addition & 2 deletions test/performance/odp_pktio_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,6 @@ static void usage(void)
static void parse_args(int argc, char *argv[], test_args_t *args)
{
int opt;
int long_index;

static const struct option longopts[] = {
{"count", required_argument, NULL, 'c'},
Expand Down Expand Up @@ -977,7 +976,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args)

while (1) {
opt = getopt_long(argc, argv, shortopts,
longopts, &long_index);
longopts, NULL);

if (opt == -1)
break;
Expand Down
4 changes: 2 additions & 2 deletions test/performance/odp_pool_latency.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ static parse_result_t check_options(prog_config_t *config)

static parse_result_t parse_options(int argc, char **argv, prog_config_t *config)
{
int opt, long_index;
int opt;

static const struct option longopts[] = {
{ "burst_pattern", required_argument, NULL, 'b' },
Expand All @@ -589,7 +589,7 @@ static parse_result_t parse_options(int argc, char **argv, prog_config_t *config
init_config(config);

while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
opt = getopt_long(argc, argv, shortopts, longopts, NULL);

if (opt == -1)
break;
Expand Down
Loading

0 comments on commit a4918ab

Please sign in to comment.