Skip to content

Commit 5a4f0f0

Browse files
committed
FIX: code refactoring
Keeping just a `MT_Map` function for making a new `map` value. Years ago I introduced `Copy_Map`, because I was just learning the code structure.. now I'm a little bit more advanced and so know, that `MT_*` are common functions for _making datatype *_ and that the `type` argument of this function is used to specify, how to deal with values, when we want to `copy` the `map`.
1 parent a84522c commit 5a4f0f0

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/core/t-map.c

+4-16
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,9 @@
324324
}
325325
}
326326

327-
328327
/***********************************************************************
329328
**
330-
*/ REBFLG Copy_Map(REBVAL *out, REBVAL *data, REBU64 types)
329+
*/ REBFLG MT_Map(REBVAL *out, REBVAL *data, REBCNT type)
331330
/*
332331
***********************************************************************/
333332
{
@@ -344,7 +343,7 @@
344343
//COPY_BLK_PART(series, VAL_BLK_DATA(data), n);
345344
Append_Map(series, data, UNKNOWN);
346345

347-
if (types != 0) Copy_Deep_Values(series, 0, SERIES_TAIL(series), types);
346+
if (type != 0) Copy_Deep_Values(series, 0, SERIES_TAIL(series), type);
348347

349348
Rehash_Hash(series);
350349

@@ -354,17 +353,6 @@
354353
}
355354

356355

357-
/***********************************************************************
358-
**
359-
*/ REBFLG MT_Map(REBVAL *out, REBVAL *data, REBCNT type)
360-
/*
361-
***********************************************************************/
362-
{
363-
//Oldes: MT means "make type" and has fixed arguments
364-
return Copy_Map(out, data, 0);
365-
}
366-
367-
368356
/***********************************************************************
369357
**
370358
*/ REBSER *Map_To_Block(REBSER *mapser, REBINT what)
@@ -521,7 +509,7 @@
521509
case A_TO:
522510
// make map! [word val word val]
523511
if (IS_BLOCK(arg) || IS_PAREN(arg) || IS_MAP(arg)) {
524-
if (Copy_Map(D_RET, arg, 0)) return R_RET;
512+
if (MT_Map(D_RET, arg, 0)) return R_RET;
525513
Trap_Arg(arg);
526514
// } else if (IS_NONE(arg)) {
527515
// n = 3; // just a start
@@ -547,7 +535,7 @@
547535
if (IS_DATATYPE(arg)) types |= TYPESET(VAL_DATATYPE(arg));
548536
else types |= VAL_TYPESET(arg);
549537
}
550-
if (Copy_Map(D_RET, val, types)) return R_RET;
538+
if (MT_Map(D_RET, val, types)) return R_RET;
551539
Trap_Arg(val);
552540
}
553541
case A_CLEAR:

0 commit comments

Comments
 (0)