From: Christoph Egger <Christoph.Egger@amd.com>
To: Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: Anthony Perard <anthony.perard@citrix.com>,
Xen Devel <xen-devel@lists.xensource.com>,
Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: Re: [PATCH RESEND V8 4/7] libxl: Introduce libxl__realloc.
Date: Thu, 22 Sep 2011 10:17:17 +0200 [thread overview]
Message-ID: <4E7AEF0D.5060304@amd.com> (raw)
In-Reply-To: <1316619995.3891.221.camel@zakaz.uk.xensource.com>
On 09/21/11 17:46, Ian Campbell wrote:
> On Wed, 2011-09-21 at 14:58 +0100, Christoph Egger wrote:
>> On 09/21/11 15:34, Ian Campbell wrote:
>>> On Wed, 2011-09-21 at 13:59 +0100, Anthony PERARD wrote:
>>>> Signed-off-by: Anthony PERARD<anthony.perard@citrix.com>
>>>
>>> Acked-by: Ian Campbell<ian.campbell@citrix.com>
>>>
>>>> ---
>>>> tools/libxl/libxl_internal.c | 24 ++++++++++++++++++++++++
>>>> tools/libxl/libxl_internal.h | 1 +
>>>> 2 files changed, 25 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
>>>> index e259278..c4d54f9 100644
>>>> --- a/tools/libxl/libxl_internal.c
>>>> +++ b/tools/libxl/libxl_internal.c
>>>> @@ -102,6 +102,30 @@ void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size)
>>>> return ptr;
>>>> }
>>>>
>>>> +void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size)
>>>> +{
>>>> + void *new_ptr = realloc(ptr, new_size);
>>>> + int i = 0;
>>>> +
>>>> + if (new_ptr == NULL&& new_size != 0) {
>>>> + return NULL;
>>>> + }
>>>> +
>>>> + if (ptr == NULL) {
>>>> + libxl__ptr_add(gc, new_ptr);
>>>> + } else if (new_ptr != ptr) {
>>>> + for (i = 0; i< gc->alloc_maxsize; i++) {
>>>> + if (gc->alloc_ptrs[i] == ptr) {
>>>> + gc->alloc_ptrs[i] = new_ptr;
>>>> + break;
>>>> + }
>>>> + }
>>>> + }
>>>> +
>>>> +
>>>> + return new_ptr;
>>>> +}
>>>> +
>>>> char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...)
>>>> {
>>>> char *s;
>>>> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
>>>> index 739e45e..5d270bb 100644
>>>> --- a/tools/libxl/libxl_internal.h
>>>> +++ b/tools/libxl/libxl_internal.h
>>>> @@ -145,6 +145,7 @@ _hidden int libxl__ptr_add(libxl__gc *gc, void *ptr);
>>>> _hidden void libxl__free_all(libxl__gc *gc);
>>>> _hidden void *libxl__zalloc(libxl__gc *gc, int bytes);
>>>> _hidden void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size);
>>
>> What is the difference between libxl__zalloc and libxl__calloc?
>
> The interface they provide? One of them is effectively a convenience
> version of the other. Surely you can look in the code and see this as
> easily as anyone else.
I prefer a documentation.
>
>>
>>>> +_hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size);
>>>> _hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
>>>> _hidden char *libxl__strdup(libxl__gc *gc, const char *c);
>>>> _hidden char *libxl__dirname(libxl__gc *gc, const char *s);
>>>
>>>
>>>
>>> _______________________________________________
>>> Xen-devel mailing list
>>> Xen-devel@lists.xensource.com
>>> http://lists.xensource.com/xen-devel
>>>
>>
>>
>
>
>
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
next prev parent reply other threads:[~2011-09-22 8:17 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-21 12:59 [PATCH RESEND V8 0/7] Introduce a QMP client Anthony PERARD
2011-09-21 12:59 ` [PATCH RESEND V8 1/7] libxl: Rename libxl.idl to libxl_types.idl Anthony PERARD
2011-09-21 13:30 ` Ian Campbell
2011-09-21 12:59 ` [PATCH RESEND V8 2/7] libxl: Add get/set_default_namespace in libxltypes.py Anthony PERARD
2011-09-21 13:31 ` Ian Campbell
2011-09-21 12:59 ` [PATCH RESEND V8 3/7] libxl: Introduce libxl_internal_types.idl Anthony PERARD
2011-09-21 13:32 ` Ian Campbell
2011-09-21 12:59 ` [PATCH RESEND V8 4/7] libxl: Introduce libxl__realloc Anthony PERARD
2011-09-21 13:34 ` Ian Campbell
2011-09-21 13:58 ` Christoph Egger
2011-09-21 15:46 ` Ian Campbell
2011-09-22 8:17 ` Christoph Egger [this message]
2011-09-22 8:52 ` Ian Campbell
2011-10-06 14:24 ` Ian Jackson
2011-09-21 12:59 ` [PATCH RESEND V8 5/7] libxl: Intruduce libxl__strndup Anthony PERARD
2011-09-21 13:35 ` Ian Campbell
2011-09-21 13:59 ` Christoph Egger
2011-09-21 15:44 ` Ian Campbell
2011-09-21 12:59 ` [PATCH RESEND V8 6/7] libxl: Introduce JSON parsing stuff Anthony PERARD
2011-09-21 13:51 ` Ian Campbell
2011-09-21 12:59 ` [PATCH RESEND V8 7/7] libxl: Introduce a QMP client Anthony PERARD
2011-09-21 13:52 ` Ian Campbell
2011-09-28 15:55 ` [PATCH RESEND V8 0/7] " Ian Jackson
2011-09-29 11:02 ` Anthony PERARD
2011-09-29 13:56 ` Ian Jackson
2011-09-29 14:03 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E7AEF0D.5060304@amd.com \
--to=christoph.egger@amd.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=Stefano.Stabellini@eu.citrix.com \
--cc=anthony.perard@citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.