i2c_spi_buses:Track NuttX change to getopts avoid name collision

NuttX #defined optarg and getopt to move to TLS. This fixes the
  name collision.
This commit is contained in:
David Sidrane
2021-04-20 10:47:11 -07:00
committed by Julian Oes
parent 64db89ab20
commit 84dd8839a2
55 changed files with 245 additions and 214 deletions

View File

@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (C) 2020 PX4 Development Team. All rights reserved.
* Copyright (C) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -51,15 +51,15 @@ static pthread_mutex_t i2c_spi_module_instances_mutex = PTHREAD_MUTEX_INITIALIZE
const char *BusCLIArguments::parseDefaultArguments(int argc, char *argv[])
{
if (getopt(argc, argv, "") == EOF) {
return optarg();
if (getOpt(argc, argv, "") == EOF) {
return optArg();
}
// unexpected arguments
return nullptr;
}
int BusCLIArguments::getopt(int argc, char *argv[], const char *options)
int BusCLIArguments::getOpt(int argc, char *argv[], const char *options)
{
if (_options[0] == 0) { // need to initialize
if (!validateConfiguration()) {

View File

@@ -92,13 +92,13 @@ public:
/**
* Like px4_getopt(), but adds and handles i2c/spi driver-specific arguments
*/
int getopt(int argc, char *argv[], const char *options);
int getOpt(int argc, char *argv[], const char *options);
/**
* returns the current optional argument (for options like 'T:'), or the command (e.g. "start")
* @return nullptr or argument/command
*/
const char *optarg() const { return _optarg; }
const char *optArg() const { return _optarg; }
I2CSPIBusOption bus_option{I2CSPIBusOption::All};