From: Matthew Fernandez Date: Mon, 4 Apr 2022 14:40:29 +0000 (-0700) Subject: Lasi plugin: use '#ifdef' instead of '#if' for config checks X-Git-Tag: 4.0.0~117^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b590cd817ff77f8f14dbab6b52d10b4a2d00bfa;p=graphviz Lasi plugin: use '#ifdef' instead of '#if' for config checks 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 --- diff --git a/plugin/lasi/gvloadimage_lasi.c b/plugin/lasi/gvloadimage_lasi.c index 54de8cac7..4ee2bab7b 100644 --- a/plugin/lasi/gvloadimage_lasi.c +++ b/plugin/lasi/gvloadimage_lasi.c @@ -15,7 +15,7 @@ #include #include #include -#if HAVE_SYS_MMAN_H +#ifdef HAVE_SYS_MMAN_H #include #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;