Skip to content

Commit 70c3797

Browse files
nschonnimgreter
authored andcommitted
Remove unused declarations and assignments
1 parent 7e29875 commit 70c3797

File tree

11 files changed

+25
-27
lines changed

11 files changed

+25
-27
lines changed

src/ast.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,8 @@ namespace Sass {
11151115
error("Invalid parent selector", pstate_);
11161116
} else if (last()->head_ && last()->head_->length()) {
11171117
Compound_Selector_Obj rh = last()->head();
1118-
size_t i = 0, L = h->length();
1118+
size_t i;
1119+
size_t L = h->length();
11191120
if (Cast<Element_Selector>(h->first())) {
11201121
if (Class_Selector_Ptr sq = Cast<Class_Selector>(rh->last())) {
11211122
Class_Selector_Ptr sqs = SASS_MEMORY_COPY(sq);
@@ -1745,7 +1746,8 @@ namespace Sass {
17451746
denominator_units_(std::vector<std::string>()),
17461747
hash_(0)
17471748
{
1748-
size_t l = 0, r = 0;
1749+
size_t l = 0;
1750+
size_t r;
17491751
if (!u.empty()) {
17501752
bool nominator = true;
17511753
while (true) {

src/ast.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3001,7 +3001,7 @@ namespace Sass {
30013001
virtual unsigned long specificity() const
30023002
{
30033003
unsigned long sum = 0;
3004-
unsigned long specificity = 0;
3004+
unsigned long specificity;
30053005
for (size_t i = 0, L = length(); i < L; ++i)
30063006
{
30073007
specificity = (*this)[i]->specificity();

src/context.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,8 @@ namespace Sass {
696696
char* Context::render_srcmap()
697697
{
698698
if (source_map_file == "") return 0;
699-
char* result = 0;
700699
std::string map = emitter.render_srcmap(*this);
701-
result = sass_copy_c_string(map.c_str());
702-
return result;
700+
return sass_copy_c_string(map.c_str());
703701
}
704702

705703

src/cssize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ namespace Sass {
442442

443443
for (size_t j = 0, K = slice->length(); j < K; ++j)
444444
{
445-
Statement_Ptr ss = NULL;
445+
Statement_Ptr ss;
446446
Statement_Obj stm = slice->at(j);
447447
// this has to go now here (too bad)
448448
Bubble_Obj node = Cast<Bubble>(stm);

src/eval.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,8 @@ namespace Sass {
618618
AST_Node_Obj lu = lhs;
619619
AST_Node_Obj ru = rhs;
620620

621-
Expression::Concrete_Type l_type = lhs->concrete_type();
622-
Expression::Concrete_Type r_type = rhs->concrete_type();
621+
Expression::Concrete_Type l_type;
622+
Expression::Concrete_Type r_type;
623623

624624
// Is one of the operands an interpolant?
625625
String_Schema_Obj s1 = Cast<String_Schema>(b->left());
@@ -661,8 +661,6 @@ namespace Sass {
661661
To_Value to_value(ctx);
662662
Value_Obj v_l = Cast<Value>(lhs->perform(&to_value));
663663
Value_Obj v_r = Cast<Value>(rhs->perform(&to_value));
664-
l_type = lhs->concrete_type();
665-
r_type = rhs->concrete_type();
666664

667665
if (s2 && s2->has_interpolants() && s2->length()) {
668666
Textual_Obj front = Cast<Textual>(s2->elements().front());
@@ -710,7 +708,7 @@ namespace Sass {
710708

711709
// ToDo: throw error in op functions
712710
// ToDo: then catch and re-throw them
713-
Expression_Obj rv = 0;
711+
Expression_Obj rv;
714712
try {
715713
ParserState pstate(b->pstate());
716714
if (l_type == Expression::NUMBER && r_type == Expression::NUMBER) {

src/extend.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,12 +1013,10 @@ namespace Sass {
10131013
} else if (((op1.combinator() == Complex_Selector::PRECEDES && op2.combinator() == Complex_Selector::ADJACENT_TO)) || ((op1.combinator() == Complex_Selector::ADJACENT_TO && op2.combinator() == Complex_Selector::PRECEDES))) {
10141014

10151015
Node tildeSel = sel1;
1016-
Node tildeOp = op1;
10171016
Node plusSel = sel2;
10181017
Node plusOp = op2;
10191018
if (op1.combinator() != Complex_Selector::PRECEDES) {
10201019
tildeSel = sel2;
1021-
tildeOp = op2;
10221020
plusSel = sel1;
10231021
plusOp = op1;
10241022
}

src/file.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace Sass {
100100
// helper function to find the last directory seperator
101101
inline size_t find_last_folder_separator(const std::string& path, size_t limit = std::string::npos)
102102
{
103-
size_t pos = std::string::npos;
103+
size_t pos;
104104
size_t pos_p = path.find_last_of('/', limit);
105105
#ifdef _WIN32
106106
size_t pos_w = path.find_last_of('\\', limit);
@@ -151,7 +151,7 @@ namespace Sass {
151151
pos = 0; // remove all self references inside the path string
152152
while((pos = path.find("/./", pos)) != std::string::npos) path.erase(pos, 2);
153153

154-
pos = 0; // remove all leading and trailing self references
154+
// remove all leading and trailing self references
155155
while(path.length() > 1 && path.substr(0, 2) == "./") path.erase(0, 2);
156156
while((pos = path.length()) > 1 && path.substr(pos - 2) == "/.") path.erase(pos - 2);
157157

src/functions.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ namespace Sass {
328328
double min = std::min(r, std::min(g, b));
329329
double delta = max - min;
330330

331-
double h = 0, s = 0, l = (max + min) / 2.0;
331+
double h = 0;
332+
double s;
333+
double l = (max + min) / 2.0;
332334

333335
if (max == min) {
334336
h = s = 0; // achromatic

src/parser.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ namespace Sass {
633633
// this is the main entry point for most
634634
Selector_List_Obj Parser::parse_selector_list(bool chroot)
635635
{
636-
bool reloop = true;
636+
bool reloop;
637637
bool had_linefeed = false;
638638
Complex_Selector_Obj sel;
639639
Selector_List_Obj group = SASS_MEMORY_NEW(Selector_List, pstate);
@@ -1662,7 +1662,7 @@ namespace Sass {
16621662
css_error("Invalid CSS", " after ", ": expected expression (e.g. 1px, bold), was ");
16631663
}
16641664

1665-
const char* e = 0;
1665+
const char* e;
16661666
const char* ee = end;
16671667
end = stop;
16681668
size_t num_items = 0;
@@ -1685,7 +1685,7 @@ namespace Sass {
16851685
if (peek< exactly< rbrace > >()) {
16861686
css_error("Invalid CSS", " after ", ": expected expression (e.g. 1px, bold), was ");
16871687
}
1688-
Expression_Obj ex = 0;
1688+
Expression_Obj ex;
16891689
if (lex< re_static_expression >()) {
16901690
ex = SASS_MEMORY_NEW(String_Constant, pstate, lexed);
16911691
} else {
@@ -2083,7 +2083,7 @@ namespace Sass {
20832083
if (!lex_css< exactly<'('> >()) {
20842084
error("media query expression must begin with '('", pstate);
20852085
}
2086-
Expression_Obj feature = 0;
2086+
Expression_Obj feature;
20872087
if (peek_css< exactly<')'> >()) {
20882088
error("media feature required in media query expression", pstate);
20892089
}
@@ -2117,7 +2117,7 @@ namespace Sass {
21172117
Supports_Condition_Obj Parser::parse_supports_condition()
21182118
{
21192119
lex < css_whitespace >();
2120-
Supports_Condition_Obj cond = 0;
2120+
Supports_Condition_Obj cond;
21212121
if ((cond = parse_supports_negation())) return cond;
21222122
if ((cond = parse_supports_operator())) return cond;
21232123
if ((cond = parse_supports_interpolation())) return cond;
@@ -2164,7 +2164,7 @@ namespace Sass {
21642164
// look like declarations their semantics differ significantly
21652165
Supports_Condition_Obj Parser::parse_supports_declaration()
21662166
{
2167-
Supports_Condition_Ptr cond = 0;
2167+
Supports_Condition_Ptr cond;
21682168
// parse something declaration like
21692169
Declaration_Obj declaration = parse_declaration();
21702170
if (!declaration) error("@supports condition expected declaration", pstate);
@@ -2334,7 +2334,7 @@ namespace Sass {
23342334

23352335
Expression_Obj Parser::lex_interp_string()
23362336
{
2337-
Expression_Obj rv = 0;
2337+
Expression_Obj rv;
23382338
if ((rv = lex_interp< re_string_double_open, re_string_double_close >())) return rv;
23392339
if ((rv = lex_interp< re_string_single_open, re_string_single_close >())) return rv;
23402340
return rv;
@@ -2394,7 +2394,7 @@ namespace Sass {
23942394

23952395
Expression_Obj Parser::lex_almost_any_value_token()
23962396
{
2397-
Expression_Obj rv = 0;
2397+
Expression_Obj rv;
23982398
if (*position == 0) return 0;
23992399
if ((rv = lex_almost_any_value_chars())) return rv;
24002400
// if ((rv = lex_block_comment())) return rv;

src/prelexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ namespace Sass {
576576
const char* value_combinations(const char* src) {
577577
// `2px-2px` is invalid combo
578578
bool was_number = false;
579-
const char* pos = src;
579+
const char* pos;
580580
while (src) {
581581
if ((pos = alternatives < quoted_string, identifier, percentage, hex >(src))) {
582582
was_number = false;

0 commit comments

Comments
 (0)