]> granicus.if.org Git - graphviz/commitdiff
Lasi plugin: use '#ifdef' instead of '#if' for config checks
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 4 Apr 2022 14:40:29 +0000 (07:40 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 10 Apr 2022 23:38:16 +0000 (16:38 -0700)
If sys/mman.h is absent, `HAVE_SYS_MMAN_H` ends up not defined at all. A result
of this would be pre-processor warnings, failing the CMake build.

Gitlab: #1836

plugin/lasi/gvloadimage_lasi.c

index 54de8cac74383239159473a4c93125af39397cd5..4ee2bab7bb9648dc650da57912e91a169baf09dc 100644 (file)
@@ -15,7 +15,7 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#if HAVE_SYS_MMAN_H
+#ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
 #ifdef _MSC_VER
@@ -35,7 +35,7 @@ typedef enum {
 
 static void ps_freeimage(usershape_t *us)
 {
-#if HAVE_SYS_MMAN_H
+#ifdef HAVE_SYS_MMAN_H
     munmap(us->data, us->datasize);
 #else
     free(us->data);
@@ -70,7 +70,7 @@ static void lasi_loadimage_ps(GVJ_t * job, usershape_t *us, boxf b, bool filled)
             case FT_EPS:
                fstat(fd, &statbuf);
                us->datasize = statbuf.st_size;
-#if HAVE_SYS_MMAN_H
+#ifdef HAVE_SYS_MMAN_H
                us->data = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
                if (us->data == MAP_FAILED)
                        us->data = NULL;