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:
Antonio SJ Musumeci 2020-12-19 15:06:08 -05:00
parent 2e4c6c5fd1
commit 538467b86d
327 changed files with 6691 additions and 3036 deletions

View file

@ -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;
}