Skip to content

Commit c4bc306

Browse files
committed
Replace LISTadd macro with LISTadd_last
No clue why the macro was used: #define LISTadd(list, item) LISTadd_last(list, item) substitution via for i in `grep -lr LISTadd[^_]`; do sed -i -e 's/LISTadd\([^_]\)/LISTadd_last\1/;' $i; done
1 parent 0cccfdd commit c4bc306

File tree

14 files changed

+269
-277
lines changed

14 files changed

+269
-277
lines changed

include/express/linklist.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,10 @@ extern SC_EXPRESS_EXPORT struct freelist_head LIST_fl;
110110
(((struct Linked_List_*)list)->mark->next->data)
111111

112112
/** function aliases */
113-
#define LISTadd(list, item) LISTadd_last(list, item)
114113
#define LISTadd_all(list, items) \
115-
LISTdo(items, e, Generic) \
116-
LISTadd(list, e); \
117-
LISTod;
114+
LISTdo(items, e, Generic) { \
115+
LISTadd_last(list, e); \
116+
} LISTod;
118117

119118
/***********************/
120119
/* function prototypes */

src/exp2cxx/classes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void USEREFout( Schema schema, Dictionary refdict, Linked_List reflist, char * t
168168
DICTdefine( dict, r->schema->symbol.name, ( Generic ) list,
169169
( Symbol * )0, OBJ_UNKNOWN );
170170
}
171-
LISTadd( list, ( Generic ) r );
171+
LISTadd_last( list, ( Generic ) r );
172172
}
173173

174174
/* step 2: for each list, print out the renames */

src/exp2python/src/classes_python.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ USEREFout( Schema schema, Dictionary refdict, Linked_List reflist, char * type,
168168
DICTdefine( dict, r->schema->symbol.name, list,
169169
( Symbol * )0, OBJ_UNKNOWN );
170170
}
171-
LISTadd( list, r );
171+
LISTadd_last( list, r );
172172
}
173173

174174
/* step 2: for each list, print out the renames */

src/exppp/exppp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ REFout( Dictionary refdict, Linked_List reflist, char * type, int level ) {
395395
DICTdefine( dict, r->schema->symbol.name, ( Generic ) list,
396396
( Symbol * )0, OBJ_UNKNOWN );
397397
}
398-
LISTadd( list, ( Generic ) r );
398+
LISTadd_last( list, ( Generic ) r );
399399
}
400400

401401
/* step 2: for each list, print out the renames */

src/express/Changes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ returned as a list or a dictionary. In fact, it is possible to hide
345345
this as well - I don't know why Steve didn't bother, except that he
346346
was tired.
347347

348-
For example, instead of a single LISTadd routine, there would have to
349-
different LISTadd routines for every class. This would have improved
348+
For example, instead of a single LISTadd_last routine, there would have to
349+
different LISTadd_last routines for every class. This would have improved
350350
typechecking.
351351

352352
The new code is more efficient for a variety of reasons. The original

src/express/entity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ void ENTITYadd_instance( Entity entity, Generic instance ) {
356356
if( entity->u.entity->instances == LIST_NULL ) {
357357
entity->u.entity->instances = LISTcreate();
358358
}
359-
LISTadd( entity->u.entity->instances, instance );
359+
LISTadd_last( entity->u.entity->instances, instance );
360360
}
361361

362362
/**

src/express/error.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void ERRORcreate_warning( char * name, Error error ) {
163163
/* first check if we know about this type of error */
164164
LISTdo( ERRORwarnings, opt, Error_Warning )
165165
if( streq( name, opt->name ) ) {
166-
LISTadd( opt->errors, ( Generic )error );
166+
LISTadd_last( opt->errors, ( Generic )error );
167167
return;
168168
}
169169
LISTod
@@ -172,8 +172,8 @@ void ERRORcreate_warning( char * name, Error error ) {
172172
o = ERROR_OPT_new();
173173
o->name = name;
174174
o->errors = LISTcreate();
175-
LISTadd( o->errors, ( Generic )error );
176-
LISTadd( ERRORwarnings, ( Generic )o );
175+
LISTadd_last( o->errors, ( Generic )error );
176+
LISTadd_last( ERRORwarnings, ( Generic )o );
177177
}
178178

179179
void ERRORset_warning( char * name, int set ) {

src/express/expparse.y

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,14 @@ aggregate_init_element(A) ::= expression(B).
428428
aggregate_init_body(A) ::= aggregate_init_element(B).
429429
{
430430
A = LISTcreate();
431-
LISTadd(A, (Generic)B);
431+
LISTadd_last(A, (Generic)B);
432432
}
433433
aggregate_init_body(A) ::= aggregate_init_element(B) TOK_COLON expression(C).
434434
{
435435
A = LISTcreate();
436-
LISTadd(A, (Generic)B);
436+
LISTadd_last(A, (Generic)B);
437437

438-
LISTadd(A, (Generic)C);
438+
LISTadd_last(A, (Generic)C);
439439

440440
B->type->u.type->body->flags.repeat = 1;
441441
}
@@ -1416,7 +1416,7 @@ reference_clause ::= TOK_REFERENCE TOK_FROM TOK_IDENTIFIER(A) semicolon.
14161416
CURRENT_SCHEMA->ref_schemas = LISTcreate();
14171417
}
14181418

1419-
LISTadd(CURRENT_SCHEMA->ref_schemas, (Generic)A.symbol);
1419+
LISTadd_last(CURRENT_SCHEMA->ref_schemas, (Generic)A.symbol);
14201420
}
14211421
reference_clause(A) ::= reference_head(B) parened_rename_list semicolon.
14221422
{
@@ -1435,7 +1435,7 @@ use_clause ::= TOK_USE TOK_FROM TOK_IDENTIFIER(A) semicolon.
14351435
CURRENT_SCHEMA->use_schemas = LISTcreate();
14361436
}
14371437

1438-
LISTadd(CURRENT_SCHEMA->use_schemas, (Generic)A.symbol);
1438+
LISTadd_last(CURRENT_SCHEMA->use_schemas, (Generic)A.symbol);
14391439
}
14401440
use_clause(A) ::= use_head(B) parened_rename_list semicolon.
14411441
{
@@ -1691,7 +1691,7 @@ defined_type(A) ::= TOK_IDENTIFIER(B).
16911691
defined_type_list(A) ::= defined_type(B).
16921692
{
16931693
A = LISTcreate();
1694-
LISTadd(A, (Generic)B);
1694+
LISTadd_last(A, (Generic)B);
16951695

16961696
}
16971697
defined_type_list(A) ::= defined_type_list(B) TOK_COMMA defined_type(C).
@@ -1969,7 +1969,7 @@ rule_formal_parameter(A) ::= TOK_IDENTIFIER(B).
19691969
rule_formal_parameter_list(A) ::= rule_formal_parameter(B).
19701970
{
19711971
A = LISTcreate();
1972-
LISTadd(A, (Generic)B);
1972+
LISTadd_last(A, (Generic)B);
19731973
}
19741974
rule_formal_parameter_list(A) ::= rule_formal_parameter_list(B) TOK_COMMA
19751975
rule_formal_parameter(C).
@@ -2426,7 +2426,7 @@ where_clause(A) ::= TOK_IDENTIFIER(B) TOK_COLON expression(C) semicolon.
24262426
where_clause_list(A) ::= where_clause(B).
24272427
{
24282428
A = LISTcreate();
2429-
LISTadd(A, (Generic)B);
2429+
LISTadd_last(A, (Generic)B);
24302430
}
24312431
where_clause_list(A) ::= where_clause_list(B) where_clause(C).
24322432
{

src/express/express.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static void EXPRESS_PATHinit() {
335335
/* if no EXPRESS_PATH, search current directory anyway */
336336
dir = ( Dir * )sc_malloc( sizeof( Dir ) );
337337
dir->leaf = dir->full;
338-
LISTadd( EXPRESS_path, ( Generic )dir );
338+
LISTadd_last( EXPRESS_path, ( Generic )dir );
339339
} else {
340340
int done = 0;
341341
while( !done ) {
@@ -372,7 +372,7 @@ static void EXPRESS_PATHinit() {
372372
/* just "" to make error messages cleaner */
373373
if( streq( ".", start ) ) {
374374
dir->leaf = dir->full;
375-
LISTadd( EXPRESS_path, ( Generic )dir );
375+
LISTadd_last( EXPRESS_path, ( Generic )dir );
376376
*( p - 1 ) = save; /* put char back where */
377377
/* temp null was */
378378
continue;
@@ -389,7 +389,7 @@ static void EXPRESS_PATHinit() {
389389
sprintf( dir->full, "%s/", start );
390390
dir->leaf = dir->full + length + 1;
391391
}
392-
LISTadd( EXPRESS_path, ( Generic )dir );
392+
LISTadd_last( EXPRESS_path, ( Generic )dir );
393393

394394
*( p - 1 ) = save; /* put char back where temp null was */
395395
}

0 commit comments

Comments
 (0)