Skip to content

Commit

Permalink
Install special handler for copying immutable plists
Browse files Browse the repository at this point in the history
  • Loading branch information
markuspf committed Jul 18, 2017
1 parent d308b56 commit 2787714
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/plist.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,18 +971,19 @@ Obj FuncIS_PLIST_REP (
**
** 'CleanPlist' is the function in 'CleanObjFuncs' for plain lists.
*/
Obj CopyPlist (
Obj list,
Int mut )
Obj CopyPlistImm(Obj list, Int mut)
{
GAP_ASSERT(!IS_MUTABLE_OBJ(list));
return list;
}

Obj CopyPlist(Obj list, Int mut)
{
Obj copy; /* copy, result */
Obj tmp; /* temporary variable */
UInt i; /* loop variable */

/* don't change immutable objects */
if ( ! IS_MUTABLE_OBJ(list) ) {
return list;
}
GAP_ASSERT(IS_MUTABLE_OBJ(list);

/* make a copy */
if ( mut ) {
Expand Down Expand Up @@ -4619,7 +4620,7 @@ static Int InitKernel (
/* install the copy list methods */
for ( t1 = T_PLIST; t1 <= LAST_PLIST_TNUM; t1 += 2 ) {
CopyObjFuncs [ t1 ] = CopyPlist;
CopyObjFuncs [ t1 +IMMUTABLE ] = CopyPlist;
CopyObjFuncs [ t1 +IMMUTABLE ] = CopyPlistImm;
CopyObjFuncs [ t1 +COPYING ] = CopyPlistCopy;
CopyObjFuncs [ t1 +IMMUTABLE +COPYING ] = CopyPlistCopy;
CleanObjFuncs[ t1 ] = CleanPlist;
Expand Down

0 comments on commit 2787714

Please sign in to comment.