From 07c7fdb9df82c7fc4ae501e21262f781df4ae5e5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 29 Jul 2014 13:22:24 -0300 Subject: simpler definition for 'setobj' (trust the compiler for the assignment) --- lobject.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lobject.h') diff --git a/lobject.h b/lobject.h index a5827f84..93356dd2 100644 --- a/lobject.h +++ b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.98 2014/07/18 13:36:14 roberto Exp roberto $ +** $Id: lobject.h,v 2.99 2014/07/18 14:46:47 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -241,8 +241,7 @@ typedef struct lua_TValue TValue; #define setobj(L,obj1,obj2) \ - { const TValue *io2=(obj2); TValue *io1=(obj1); \ - io1->value_ = io2->value_; io1->tt_ = io2->tt_; \ + { TValue *io1=(obj1); *io1 = *(obj2); \ (void)L; checkliveness(G(L),io1); } @@ -471,6 +470,13 @@ typedef union TKey { } TKey; +/* copy a value into a key without messing up field 'next' */ +#define setkey(L,key,obj) \ + { TKey *k_=(key); const TValue *io_=(obj); \ + k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \ + (void)L; checkliveness(G(L),io_); } + + typedef struct Node { TValue i_val; TKey i_key; -- cgit v1.2.3-55-g6feb