]> granicus.if.org Git - graphviz/commitdiff
common: add declaration of drand48 to utils.h when the system doesn't have it
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 26 Jul 2021 14:51:16 +0000 (16:51 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Wed, 25 Aug 2021 16:18:44 +0000 (18:18 +0200)
This function is implemented in utils.c when not available otherwise.

Removes this warning with MinGW:

C:/Users/magja/graphviz/lib/fdpgen/tlayout.c:597:33: warning: implicit declaration of function 'drand48'; did you mean 'srand48'? [-Wimplicit-function-declaration]
  597 |       double angle = PItimes2 * drand48();
      |                                 ^~~~~~~
      |                                 srand48

lib/common/utils.h

index 26cc9f71e969f07555c9611d56cda01443e7b391..2f05868474f06bcf2eee47a05c1e961b1c5deda5 100644 (file)
@@ -11,6 +11,8 @@
 #ifndef _UTILS_H
 #define _UTILS_H 1
 
+#include "config.h"
+
 #include <cgraph/agxbuf.h>
 #include <stdbool.h>
 
@@ -103,6 +105,10 @@ extern "C" {
     /* from postproc.c */ 
     UTILS_API void gv_nodesize(Agnode_t * n, boolean flip);
 
+#ifndef HAVE_DRAND48
+    UTILS_API double drand48(void);
+#endif
+
     /* from timing.c */
     UTILS_API void start_timer(void);
     UTILS_API double elapsed_sec(void);