Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 2f9a058

Browse files
committed
Make source strings const
1 parent e997102 commit 2f9a058

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace Sass {
5656
function_env(map<string, Function>()),
5757
extensions(multimap<Node, Node>()),
5858
pending_extensions(vector<pair<Node, Node> >()),
59-
source_refs(vector<char*>()),
59+
source_refs(vector<const char*>()),
6060
include_paths(vector<string>()),
6161
color_names_to_values(map<string, Node>()),
6262
color_values_to_names(map<Node, string>()),

context.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Sass {
2323
map<string, Function> function_env;
2424
multimap<Node, Node> extensions;
2525
vector<pair<Node, Node> > pending_extensions;
26-
vector<char*> source_refs; // all the source c-strings
26+
vector<const char*> source_refs; // all the source c-strings
2727
vector<string> include_paths;
2828
map<string, Node> color_names_to_values;
2929
map<Node, string> color_values_to_names;

document.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace Sass {
8686
return doc;
8787
}
8888

89-
Document Document::make_from_source_chars(Context& ctx, char* src, string path, bool own_source)
89+
Document Document::make_from_source_chars(Context& ctx, const char* src, string path, bool own_source)
9090
{
9191
Document doc(ctx);
9292
doc.path = path;
@@ -110,7 +110,7 @@ namespace Sass {
110110
doc.root = ctx.new_Node(Node::root, path, 1, 0);
111111
doc.lexed = Token::make();
112112
doc.own_source = false;
113-
doc.source = const_cast<char*>(t.begin);
113+
doc.source = t.begin;
114114
doc.end = t.end;
115115
doc.position = doc.source;
116116

document.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace Sass {
2929
enum CSS_Style { nested, expanded, compact, compressed, echo };
3030

3131
string path;
32-
char* source;
32+
const char* source;
3333
const char* position;
3434
const char* end;
3535
size_t line;
@@ -48,7 +48,7 @@ namespace Sass {
4848
~Document();
4949

5050
static Document make_from_file(Context& ctx, string path);
51-
static Document make_from_source_chars(Context& ctx, char* src, string path = "", bool own_source = false);
51+
static Document make_from_source_chars(Context& ctx, const char* src, string path = "", bool own_source = false);
5252
static Document make_from_token(Context& ctx, Token t, string path = "", size_t line_number = 1);
5353

5454
template <prelexer mx>
@@ -183,4 +183,4 @@ namespace Sass {
183183
string emit_css(CSS_Style style);
184184

185185
};
186-
}
186+
}

sass_interface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct sass_options {
1616
};
1717

1818
struct sass_context {
19-
char* source_string;
19+
const char* source_string;
2020
char* output_string;
2121
struct sass_options options;
2222
int error_status;
@@ -53,4 +53,4 @@ int sass_compile_folder (struct sass_folder_context* ctx);
5353

5454
#ifdef __cplusplus
5555
}
56-
#endif
56+
#endif

0 commit comments

Comments
 (0)