Skip to content

Commit a73ae26

Browse files
committed
Add sass_context_get_included_files_size to API
1 parent 7757f61 commit a73ae26

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

sass_context.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,10 @@ extern "C" {
815815
Sass_Import_Entry ADDCALL sass_compiler_get_last_import(struct Sass_Compiler* compiler) { return compiler->cpp_ctx->import_stack.back(); }
816816
Sass_Import_Entry ADDCALL sass_compiler_get_import_entry(struct Sass_Compiler* compiler, size_t idx) { return compiler->cpp_ctx->import_stack[idx]; }
817817

818+
// Calculate the size of the stored null terminated array
819+
size_t ADDCALL sass_context_get_included_files_size (struct Sass_Context* ctx)
820+
{ size_t l = 0; auto i = ctx->included_files; while (i && *i) { ++i; ++l; } return l; }
821+
818822
// Create getter and setters for options
819823
IMPLEMENT_SASS_OPTION_ACCESSOR(int, precision);
820824
IMPLEMENT_SASS_OPTION_ACCESSOR(enum Sass_Output_Style, output_style);

sass_context.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ ADDAPI size_t ADDCALL sass_context_get_error_column (struct Sass_Context* ctx);
119119
ADDAPI const char* ADDCALL sass_context_get_source_map_string (struct Sass_Context* ctx);
120120
ADDAPI char** ADDCALL sass_context_get_included_files (struct Sass_Context* ctx);
121121

122+
// Calculate the size of the stored null terminated array
123+
ADDAPI size_t ADDCALL sass_context_get_included_files_size (struct Sass_Context* ctx);
124+
122125
// Take ownership of memory (value on context is set to 0)
123126
ADDAPI char* ADDCALL sass_context_take_error_json (struct Sass_Context* ctx);
124127
ADDAPI char* ADDCALL sass_context_take_error_text (struct Sass_Context* ctx);

0 commit comments

Comments
 (0)