From c9743226026feb6a5789940f9340e5edb69ceb74 Mon Sep 17 00:00:00 2001 From: Alexandre Mutel Date: Mon, 4 Apr 2016 18:09:07 +0900 Subject: [PATCH] Use sass_option_push_include_path (as fixed in https://github.com/sass/libsass/pull/1974) --- sassc.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/sassc.c b/sassc.c index ff8e252..78758fd 100644 --- a/sassc.c +++ b/sassc.c @@ -210,8 +210,6 @@ int main(int argc, char** argv) { bool generate_source_map = false; struct Sass_Options* options = sass_make_options(); sass_option_set_output_style(options, SASS_STYLE_NESTED); - char *include_paths = NULL; - char *plugin_paths = NULL; sass_option_set_precision(options, 5); int c, i; @@ -237,32 +235,10 @@ int main(int argc, char** argv) { from_stdin = 1; break; case 'I': - if (!include_paths) { -#ifdef _MSC_VER - include_paths = _strdup(optarg); -#else - include_paths = strdup(optarg); -#endif - } else { - char *old_paths = include_paths; - include_paths = malloc(strlen(old_paths) + 1 + strlen(optarg) + 1); - sprintf(include_paths, "%s%c%s", old_paths, PATH_SEP, optarg); - free(old_paths); - } + sass_option_push_include_path(options, strdup(optarg)); break; case 'P': - if (!plugin_paths) { -#ifdef _MSC_VER - plugin_paths = _strdup(optarg); -#else - plugin_paths = strdup(optarg); -#endif - } else { - char *old_paths = plugin_paths; - plugin_paths = malloc(strlen(old_paths) + 1 + strlen(optarg) + 1); - sprintf(plugin_paths, "%s%c%s", old_paths, PATH_SEP, optarg); - free(old_paths); - } + sass_option_push_plugin_path(options, strdup(optarg)); break; case 't': for(i = 0; i < NUM_STYLE_OPTION_STRINGS; ++i) { @@ -309,9 +285,6 @@ int main(int argc, char** argv) { } } - sass_option_set_include_path(options, include_paths ? include_paths : ""); - sass_option_set_plugin_path(options, plugin_paths ? plugin_paths : ""); - if(optind < argc - 2) { fprintf(stderr, "Error: Too many arguments.\n"); invalid_usage(argv[0]); @@ -337,8 +310,5 @@ int main(int argc, char** argv) { result = compile_stdin(options, outfile); } - free(include_paths); - free(plugin_paths); - return result; }