mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-19 22:46:34 -05:00
config: rework global config, remove rwlock, make branches RCU like
Also added unit tests. Should have done separately but found a number of bugs.
This commit is contained in:
parent
2e4c6c5fd1
commit
538467b86d
327 changed files with 6691 additions and 3036 deletions
|
|
@ -17,13 +17,14 @@
|
|||
*/
|
||||
|
||||
#include "ef.hpp"
|
||||
#include "errno.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
namespace str
|
||||
{
|
||||
int
|
||||
|
|
@ -50,7 +51,17 @@ namespace str
|
|||
from(const std::string &value_,
|
||||
int *int_)
|
||||
{
|
||||
*int_ = ::strtol(value_.c_str(),NULL,10);
|
||||
int tmp;
|
||||
char *endptr;
|
||||
|
||||
errno = 0;
|
||||
tmp = ::strtol(value_.c_str(),&endptr,10);
|
||||
if(errno != 0)
|
||||
return -EINVAL;
|
||||
if(endptr == value_.c_str())
|
||||
return -EINVAL;
|
||||
|
||||
*int_ = tmp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue