[Forensics-changes] [yara] 225/407: Use integer arithmetic instead of floating point operations and fix problems in C++

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:28:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.3.0
in repository yara.

commit dc71f72e0d11baaca220e221ecb640783e0ea80a
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Fri Nov 21 17:28:27 2014 +0100

    Use integer arithmetic instead of floating point operations and fix problems in C++
---
 argparse/argparse.c |  2 +-
 argparse/argparse.h | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/argparse/argparse.c b/argparse/argparse.c
index 67fee30..e60b76c 100755
--- a/argparse/argparse.c
+++ b/argparse/argparse.c
@@ -300,7 +300,7 @@ argparse_usage(struct argparse *self)
             else
                 len += strlen("<str>");
         }
-        len = ceil((float)len / 4) * 4;
+        len = (len / 4) * 4 + 4;
         if (usage_opts_width < len) {
             usage_opts_width = len;
         }
diff --git a/argparse/argparse.h b/argparse/argparse.h
index b38a2a7..183be46 100755
--- a/argparse/argparse.h
+++ b/argparse/argparse.h
@@ -22,12 +22,15 @@
  */
 
 #include <assert.h>
-#include <math.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct argparse;
 struct argparse_option;
 
@@ -144,8 +147,8 @@ int argparse_help_cb(struct argparse *self,
     OPT_STRING_MULTI(short_name, long_name, value, 1, __VA_ARGS__)
 
 
-#define OPT_GROUP(h)   { ARGPARSE_OPT_GROUP, 0, NULL, NULL, 0, h, NULL, NULL }
-#define OPT_END()      { ARGPARSE_OPT_END }
+#define OPT_GROUP(h)   { ARGPARSE_OPT_GROUP, 0, NULL, NULL, h }
+#define OPT_END()      { ARGPARSE_OPT_END, 0 }
 
 #define OPT_HELP()     OPT_BOOLEAN('h', "help", NULL, "show self help message and exit", NULL, argparse_help_cb)
 
@@ -155,4 +158,8 @@ int argparse_init(struct argparse *self, struct argparse_option *options,
 int argparse_parse(struct argparse *self, int argc, const char **argv);
 void argparse_usage(struct argparse *self);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list