[PATCH] Get rid of dead code, and fix gettimespecofday's math.

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

 



We've got a lot of dead code here.  This removes a bunch of it.  Also,
it fixes gettimespecofday's math to yield the correct result.
---
 loader/dirbrowser.c |   17 -----------------
 loader/fwloader.c   |    7 -------
 loader/init.c       |    6 ------
 loader/loader.c     |   40 +---------------------------------------
 loader/udelay.h     |    8 +-------
 5 files changed, 2 insertions(+), 76 deletions(-)

diff --git a/loader/dirbrowser.c b/loader/dirbrowser.c
index 6c713ec..5632984 100644
--- a/loader/dirbrowser.c
+++ b/loader/dirbrowser.c
@@ -48,23 +48,6 @@ static int simpleStringCmp(const void * a, const void * b) {
 }
 #endif
 
-#if 0
-/* sample filter function */
-/* return 1 if a dir, 0 if not */
-int getOnlyDirs(char * dir, struct dirent *entry) {
-    struct stat sb;
-    char * fn = alloca(strlen(dir) + strlen(entry->d_name) + 2);
-
-    sprintf(fn, "%s/%s", dir, entry->d_name);
-    stat(fn, &sb);
-
-    if (!S_ISDIR(sb.st_mode)) {
-        return 1;
-    }
-    return 0;
-}
-#endif
-
 #define FSTEP 10
 
 static char ** get_file_list(char * dirname, 
diff --git a/loader/fwloader.c b/loader/fwloader.c
index 2ab8c7f..3c4f6f2 100644
--- a/loader/fwloader.c
+++ b/loader/fwloader.c
@@ -129,13 +129,6 @@ static int daemonize(struct fw_loader *fwl)
     int fd;
     int rc;
 
-#if 0
-    int pid;
-    pid = fork();
-    if (pid != 0)
-        return pid;
-#endif
-
     signal(SIGTERM, kill_hotplug_signal);
     signal(SIGSEGV, loaderSegvHandler);
     signal(SIGTTOU, SIG_IGN);
diff --git a/loader/init.c b/loader/init.c
index 1505657..e3bb9b0 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -131,12 +131,6 @@ static void printstr(char * string) {
 }
 
 static void fatal_error(int usePerror) {
-/* FIXME */
-#if 0
-    if (usePerror) 
-        perror("failed:");
-    else
-#endif
     printf("failed.\n");
 
     printf("\nI can't recover from this.\n");
diff --git a/loader/loader.c b/loader/loader.c
index cf2cfa4..d624ad5 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1174,25 +1174,6 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
     return;
 }
 
-#if 0
-/* determine if we are using a framebuffer console.  return 1 if so */
-static int checkFrameBuffer() {
-    int fd;
-    int rc = 0;
-    struct fb_fix_screeninfo fix;
-
-    if ((fd = open("/dev/fb0", O_RDONLY)) == -1) {
-        return 0;
-    }
-    
-    if (ioctl(fd, FBIOGET_FSCREENINFO, &fix) >= 0) {
-        rc = 1;
-    }
-    close(fd);
-    return rc;
-}
-#endif
-
 /* make sure they have enough ram */
 static void checkForRam(void) {
     if (totalMemory() < MIN_RAM) {
@@ -1787,15 +1768,6 @@ static int anaconda_trace_init(void) {
      * is well before we might take a SEGV, so they'll go to tty8 */
     initializeTtys();
 
-#if 0
-    int fd = open("/dev/tty8", O_RDWR);
-    if (fd != STDERR_FILENO) {
-        close(STDERR_FILENO);
-        dup2(fd, STDERR_FILENO);
-        close(fd);
-    }
-#endif
-
     /* set up signal handler */
     setupBacktrace();
 
@@ -2359,17 +2331,7 @@ int main(int argc, char ** argv) {
 #endif
         doExit(rc);
     }
-#if 0
-    else {
-	char **args = anacondaArgs;
-	printf("would have run ");
-	while (*args)
-	    printf("%s ", *args++);
-	printf("\n");
-	printf("LANGKEY=%s\n", getenv("LANGKEY"));
-	printf("LANG=%s\n", getenv("LANG"));
-    }
-#endif
+
     doExit(1);
 }
 
diff --git a/loader/udelay.h b/loader/udelay.h
index 5ad0a56..5315074 100644
--- a/loader/udelay.h
+++ b/loader/udelay.h
@@ -93,13 +93,7 @@ gettimespecofday(struct timespec *ts)
     rc = gettimeofday(&tv, NULL);
     if (rc >= 0) {
         ts->tv_sec = tv.tv_sec;
-#if 0
-        ts->tv_nsec = (tv.tv_usec % NSECS_PER_USEC >= NSECS_PER_USEC / 2) ?
-            tv.tv_usec / NSECS_PER_USEC + 1 :
-            tv.tv_usec / NSECS_PER_USEC;
-#else
-        ts->tv_nsec = tv.tv_usec / NSECS_PER_USEC;
-#endif
+        ts->tv_nsec = tv.tv_usec * NSECS_PER_USEC;
     }
     return rc;
 }
-- 
1.6.5.rc2

_______________________________________________
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