[Grubby - PATCH 2/4] Add "const" specifier to function arguments

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

 



Functions addNewKernel() and getInitrdVal() do not modify their arguments,
so it is safe to mark them as "const". Also, the compiler can make extra
checks and optimizations this way.
---
 grubby.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/grubby.c b/grubby.c
index 71edce7..2dea8ee 100644
--- a/grubby.c
+++ b/grubby.c
@@ -188,14 +188,14 @@ static struct singleEntry * findTemplate(struct grubConfig * cfg,
 static int addNewKernel(struct grubConfig * config,
                         struct singleEntry * template,
                         const char * prefix,
-                        char * newKernelPath,
-                        char * newKernelTitle,
-                        char * newKernelArgs,
-                        char * newKernelInitrd,
-                        char ** extraInitrds,
+                        const char * newKernelPath,
+                        const char * newKernelTitle,
+                        const char * newKernelArgs,
+                        const char * newKernelInitrd,
+                        const char ** extraInitrds,
                         int extraInitrdCount,
-                        char * newMBKernel,
-                        char * newMBKernelArgs);
+                        const char * newMBKernel,
+                        const char * newMBKernelArgs);
 
 static int checkDeviceBootloader(const char * device,
                                  const unsigned char * boot);
@@ -3067,7 +3067,7 @@ static char * getRootSpecifier(char * str) {
 static char * getInitrdVal(struct grubConfig * config,
 			   const char * prefix, struct singleLine *tmplLine,
 			   const char * newKernelInitrd,
-			   char ** extraInitrds, int extraInitrdCount)
+			   const char ** extraInitrds, int extraInitrdCount)
 {
     char *initrdVal, *end;
     int i;
@@ -3112,10 +3112,10 @@ static char * getInitrdVal(struct grubConfig * config,
 
 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) {
+		 const char * newKernelPath, const char * newKernelTitle,
+		 const char * newKernelArgs, const char * newKernelInitrd,
+		 const char ** extraInitrds, int extraInitrdCount,
+                 const char * newMBKernel, const char * newMBKernelArgs) {
     struct singleEntry * new;
     struct singleLine * newLine = NULL, * tmplLine = NULL, * masterLine = NULL;
     int needs;
-- 
1.7.10.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux