chore: cleanup util

main
Sean McBride 5 years ago
parent 7da1f4a284
commit b67860112f

@ -5,6 +5,6 @@
#include <module.h>
/* perhaps move it to module.h or sandbox.h? */
int util_parse_modules_file_json(char *filename);
int util__parse_modules_file_json(char *filename);
#endif /* SFRT_UTIL_H */

@ -171,7 +171,7 @@ main(int argc, char **argv)
initialize_runtime();
debuglog("Parsing modules file [%s]\n", argv[1]);
if (util_parse_modules_file_json(argv[1])) {
if (util__parse_modules_file_json(argv[1])) {
printf("failed to parse modules file[%s]\n", argv[1]);
exit(-1);
}

@ -11,30 +11,13 @@
#define UTIL_MOD_LINE_MAX 1024
/**
* Removes leading and trailing spaces from a string
* @param str source string
* @return string without leading or training spaces
**/
static char *
util_remove_spaces(char *str)
{
int i = 0;
while (isspace(*str)) str++;
i = strlen(str);
while (isspace(str[i - 1])) str[i - 1] = '\0';
return str;
}
/**
* Parses a JSON file and allocates one or more new modules
* @param file_name The path of the JSON file
* @return RC 0 on Success. -1 on Error
*/
int
util_parse_modules_file_json(char *file_name)
util__parse_modules_file_json(char *file_name)
{
// Use stat to get file attributes and make sure file is there and OK
struct stat stat_buffer;

Loading…
Cancel
Save