[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Copying one Lisp_Object to another in C code?
From: |
Andreas Schwab |
Subject: |
Re: Copying one Lisp_Object to another in C code? |
Date: |
Fri, 02 Jul 2010 11:06:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
James Cloos <address@hidden> writes:
> Given:
>
> static void (foo)
> Lisp_Object foo;
> {
> Lisp_Object bar;
> /* etc */
>
> is it OK to do:
>
> bar = foo;
>
> or is there a function or macro one should call?
Lisp_Object values are just references (except for Lisp_Int values),
so they can be freely copied around.
> I presume GCPRO1 (foo) is in order either way?
Only if you reference a Lisp object that is not already protected from
elsewhere. For example, all argument values of built-ins are implicitly
protected.
Andreas.
--
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."