mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
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:
committed by
Julian Oes
parent
64db89ab20
commit
84dd8839a2
@@ -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()) {
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user