Merge pull request #901 from paulsapps/glib_optional

Outsource a few GLIB related functions to fluid_sys
This commit is contained in:
Tom M 2021-12-21 13:09:09 +01:00 committed by GitHub
commit 13b376819c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 7 deletions

View file

@ -441,14 +441,14 @@ fluid_command(fluid_cmd_handler_t *handler, const char *cmd, fluid_ostream_t out
return 1;
}
if(!g_shell_parse_argv(cmd, &num_tokens, &tokens, NULL))
if(!fluid_shell_parse_argv(cmd, &num_tokens, &tokens))
{
fluid_ostream_printf(out, "Error parsing command\n");
return FLUID_FAILED;
}
result = fluid_cmd_handler_handle(handler, num_tokens, &tokens[0], out);
g_strfreev(tokens);
fluid_strfreev(tokens);
return result;
}

View file

@ -896,7 +896,7 @@ int main(int argc, char **argv)
}
/* if the automatically selected command file does not exist, do not even attempt to open it */
if(!g_file_test(config_file, G_FILE_TEST_EXISTS))
if(!fluid_file_test(config_file, FLUID_FILE_TEST_EXISTS))
{
config_file = NULL;
}

View file

@ -1730,14 +1730,14 @@ FILE* fluid_file_open(const char* path, const char** errMsg)
FILE* handle = NULL;
if(!g_file_test(path, G_FILE_TEST_EXISTS))
if(!fluid_file_test(path, FLUID_FILE_TEST_EXISTS))
{
if(errMsg != NULL)
{
*errMsg = ErrExist;
}
}
else if(!g_file_test(path, G_FILE_TEST_IS_REGULAR))
else if(!fluid_file_test(path, FLUID_FILE_TEST_IS_REGULAR))
{
if(errMsg != NULL)
{

View file

@ -200,6 +200,12 @@ char* fluid_get_windows_error(void);
*/
char *fluid_strtok(char **str, char *delim);
#define FLUID_FILE_TEST_EXISTS G_FILE_TEST_EXISTS
#define FLUID_FILE_TEST_IS_REGULAR G_FILE_TEST_IS_REGULAR
#define fluid_file_test(path, flags) g_file_test(path, flags)
#define fluid_shell_parse_argv(command_line, argcp, argvp) g_shell_parse_argv(command_line, argcp, argvp, NULL)
#define fluid_strfreev g_strfreev
#if defined(__OS2__)
#define INCL_DOS

View file

@ -29,10 +29,10 @@
#ifndef _FLUIDSYNTH_PRIV_H
#define _FLUIDSYNTH_PRIV_H
#include <glib.h>
#include "config.h"
#include <glib.h>
#if HAVE_STDLIB_H
#include <stdlib.h> // malloc, free
#endif