[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] add "const" to file-scoped statics



"Daniel P. Berrange" <berrange redhat com> wrote:
> On Thu, May 08, 2008 at 04:40:11PM +0200, Jim Meyering wrote:
>> >From fed1a1abfd2b9ece7bd8e44aae13de91eaad4f5d Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <meyering redhat com>
>> Date: Wed, 7 May 2008 23:12:13 +0200
>> Subject: [PATCH] add "const" to file-scoped statics
>>
>> These were relatively new additions to the list from here:
>> nm src/*.o|grep ' D '.
>
> ACK

Thanks for the quick feedback.
I've pushed that and one more small change corresponding
to this ChangeLog entry:
It adds one more "const" and gives the struct type a name.

* src/storage_backend_fs.c (fileTypeInfo): Add "static" and two
"const" attributes.
(FileTypeInfo): Name the previously anonymous struct,
so the declaration of fileTypeInfo looks more conventional.
* src/xend_internal.c (sound_models): Mark as static, and
as an array of "const" entries.

These were relatively new additions to the list from here:
nm src/*.o|grep ' D '


>From 550f475b6a33aa06e103329696be4f55c1b3c81d Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Fri, 9 May 2008 10:05:58 +0200
Subject: [PATCH] complete the previous change

---
 src/storage_backend_fs.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/storage_backend_fs.c b/src/storage_backend_fs.c
index b41b952..36f1fb8 100644
--- a/src/storage_backend_fs.c
+++ b/src/storage_backend_fs.c
@@ -79,7 +79,7 @@ enum {
 };

 /* Either 'magic' or 'extension' *must* be provided */
-static const struct {
+struct FileTypeInfo {
     int type;           /* One of the constants above */
     const char *magic;  /* Optional string of file magic
                          * to check at head of file */
@@ -94,7 +94,8 @@ static const struct {
                            * -1 to use st_size as capacity */
     int sizeBytes;        /* Number of bytes for size field */
     int sizeMultiplier;   /* A scaling factor if size is not in bytes */
-} fileTypeInfo[] = {
+};
+const struct FileTypeInfo const fileTypeInfo[] = {
     /* Bochs */
     /* XXX Untested
     { VIR_STORAGE_VOL_BOCHS, "Bochs Virtual HD Image", NULL,
--
1.5.5.1.179.gdc42


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]