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

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

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> 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@xxxxxxxxxx>
>> 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@xxxxxxxxxx>
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

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]