Explorar el Código

Give better hints to the compiler on this logic

Bryan Drewery hace 12 años
padre
commit
7823b6a11d
Se han modificado 1 ficheros con 2 adiciones y 6 borrados
  1. 2 6
      src/binary.c

+ 2 - 6
src/binary.c

@@ -186,9 +186,7 @@ bin_checksum(const char *fname, int todo)
 
     munmap(map, size);
     close(fd);
-  }
-
-  if (todo == GET_CONF) {
+  } else if (todo == GET_CONF) {
     fd = open(fname, O_RDONLY);
     if (fd == -1) werr(ERR_BINSTAT);
     size = lseek(fd, 0, SEEK_END);
@@ -226,9 +224,7 @@ bin_checksum(const char *fname, int todo)
     close(fd);
 
     return ".";
-  }
-
-  if (todo & WRITE_CHECKSUM) {
+  } else if (todo & WRITE_CHECKSUM) {
     newbin = new Tempfile("bin", 0);
 
     size = strlen(fname) + 2;