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

Re: [Grubby - PATCH 1/4] Add forward declarations for functions



Hi,

Peter Jones <pjones redhat com> writes:

> On 06/11/2012 12:29 PM, Adrian Perez wrote:
>
>> Certain compilers may spit out a huge amount of warnings about
>> missing prototypes, or even fail to compile grubby.c if they
>> default to the C99 standard. This adds the missing prototypes
>> at the beginning of the source file, also marking the functions
>> as static -- they are not going to be used anywhere else after
>> all.
>
> What compiler does this?  I'd like the changelog to have /specific/
> details if we're making changes to deal with compiler issues.

I have been toying a bit with this, and the issue appears using GCC
(or Clang) in C89/gnu89 mode, but only when #including grubby.c as
part of another .c file which uses GObject, when the header which 
declared the GOobject is #included first... — admittedly that case
is a bit obscure.

IMHO, splittig the declarations in a separate grubby.h header file,
as suggested by Vratislav is actually more convenient for me (so
I don't need to #include grubby.c, but just the header instead),
and it is also better to try to make it easier to use the Grubby
functionality in other projects.

Opinions?

-Adrian


>> ---
>>  grubby.c |   89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 89 insertions(+)
>> 
>> diff --git a/grubby.c b/grubby.c
>> index fe8317d..71edce7 100644
>> --- a/grubby.c
>> +++ b/grubby.c
>> @@ -124,11 +124,100 @@ struct keywordTypes {
>>  };
>>  
>>  struct configFileInfo;
>> +struct grubConfig;
>>  
>>  typedef const char *(*findConfigFunc)(struct configFileInfo *);
>>  typedef const int (*writeLineFunc)(struct configFileInfo *,
>>  				struct singleLine *line);
>>  
>> +static const char *grubFindConfig(struct configFileInfo *cfi);
>> +static const char *grub2FindConfig(struct configFileInfo *cfi);
>> +static char *grub2ExtractTitle(struct singleLine * line);
>> +static int argMatch(const char * one, const char * two);
>> +static int sizeOfSingleLine(struct singleLine * line);
>> +static void removeLine(struct singleEntry * entry, struct singleLine * line);
>> +static void printEntry(struct singleEntry * entry);
>> +static void notSuitablePrintf(struct singleEntry * entry, const char *fmt, ...);
>> +static char * findBootPrefix(void);
>> +
>> +static int suitableImage(struct singleEntry * entry,
>> +                         const char * bootPrefix,
>> +                         int skipRemoved,
>> +                         int flags);
>> +
>> +static void markRemovedImage(struct grubConfig * cfg,
>> +                             const char * image,
>> +                             const char * prefix);
>> +
>> +static void setFallbackImage(struct grubConfig * config,
>> +                             int hasNew);
>> +
>> +static void setDefaultImage(struct grubConfig * config,
>> +                            int hasNew,
>> +                            const char * defaultKernelPath,
>> +                            int newIsDefault,
>> +                            const char * prefix,
>> +                            int flags);
>> +
>> +static int updateActualImage(struct grubConfig * cfg,
>> +                             const char * image,
>> +                             const char * prefix,
>> +                             const char * addArgs,
>> +                             const char * removeArgs,
>> +                             int multibootArgs);
>> +
>> +static int updateImage(struct grubConfig * cfg,
>> +                       const char * image,
>> +                       const char * prefix,
>> +                       const char * addArgs,
>> +                       const char * removeArgs,
>> +                       const char * addMBArgs,
>> +                       const char * removeMBArgs);
>> +
>> +static int updateInitrd(struct grubConfig * cfg,
>> +                        const char * image,
>> +                        const char * prefix,
>> +                        const char * initrd);
>> +
>> +static struct singleEntry * findTemplate(struct grubConfig * cfg,
>> +                                         const char * prefix,
>> +                                         int * indexPtr,
>> +                                         int skipRemoved,
>> +                                         int flags);
>> +
>> +static int addNewKernel(struct grubConfig * config,
>> +                        struct singleEntry * template,
>> +                        const char * prefix,
>> +                        char * newKernelPath,
>> +                        char * newKernelTitle,
>> +                        char * newKernelArgs,
>> +                        char * newKernelInitrd,
>> +                        char ** extraInitrds,
>> +                        int extraInitrdCount,
>> +                        char * newMBKernel,
>> +                        char * newMBKernelArgs);
>> +
>> +static int checkDeviceBootloader(const char * device,
>> +                                 const unsigned char * boot);
>> +
>> +static int checkForLilo(struct grubConfig * config);
>> +static int checkForGrub(struct grubConfig * config);
>> +static int checkForGrub2(struct grubConfig * config);
>> +static int checkLiloOnRaid(char * mdDev,
>> +                           const unsigned char * boot);
>> +
>> +static void displayEntry(struct singleEntry * entry,
>> +                         const char * prefix,
>> +                         int index);
>> +
>> +static int displayInfo(struct grubConfig * config,
>> +                       char * kernel,
>> +                       const char * prefix);
>> +
>> +static void dumpSysconfigGrub(void);
>> +static int parseSysconfigGrub(int * lbaPtr,
>> +                              char ** bootPtr);
>> +
>>  struct configFileInfo {
>>      char * defaultConfig;
>>      findConfigFunc findConfig;
>

-- 
Adrian Perez <aperez igalia com> - Sent from my toaster
Igalia - Free Software Engineering

Attachment: pgp73M5kyk8y1.pgp
Description: PGP signature


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