1 /* Copyright 2017 The Chromium OS Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 #ifndef INIPARSER_WRAPPER_H_ 6 #define INIPARSER_WRAPPER_H_ 7 8 #ifdef HAVE_INIPARSER_INIPARSER_H 9 #include <iniparser/iniparser.h> 10 #else 11 #include <iniparser.h> 12 #endif 13 #include <sys/stat.h> 14 #include <sys/types.h> 15 #include <unistd.h> 16 17 /* Allocate 63 chars + 1 for null where declared. */ 18 #define MAX_INI_NAME_LENGTH 63 19 #define MAX_INI_KEY_LENGTH 63 /* names like "output_source:output_0" */ 20 iniparser_load_wrapper(const char * ini_name)21static inline dictionary *iniparser_load_wrapper(const char *ini_name) 22 { 23 struct stat st; 24 int rc = stat(ini_name, &st); 25 if (rc < 0) 26 return NULL; 27 return iniparser_load(ini_name); 28 } 29 30 #endif /* INIPARSER_WRAPPER_H_ */ 31