[Forensics-changes] [yara] 87/135: Change some "char*" to "const char*"

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:27:35 UTC 2017


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

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

commit d75fc007606bb8967a6748c84143c7b3fc7455c4
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Mon Aug 11 12:35:19 2014 +0200

    Change some "char*" to "const char*"
---
 libyara/arena.c              | 2 +-
 libyara/include/yara/types.h | 7 +++----
 libyara/parser.c             | 4 ++--
 yara.c                       | 2 +-
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/libyara/arena.c b/libyara/arena.c
index 486b91b..0af5bf3 100644
--- a/libyara/arena.c
+++ b/libyara/arena.c
@@ -730,7 +730,7 @@ int yr_arena_write_data(
 // Args:
 //    YR_ARENA* arena        - Pointer to the arena.
 //    const char* string     - Pointer to string to be written.
-//    void** written_string  - Address where a pointer to the written data will
+//    char** written_string  - Address where a pointer to the written data will
 //                             be returned.
 //
 // Returns:
diff --git a/libyara/include/yara/types.h b/libyara/include/yara/types.h
index 2026ace..0350221 100644
--- a/libyara/include/yara/types.h
+++ b/libyara/include/yara/types.h
@@ -69,7 +69,7 @@ typedef struct _YR_META
   int32_t type;
   int32_t integer;
 
-  DECLARE_REFERENCE(char*, identifier);
+  DECLARE_REFERENCE(const char*, identifier);
   DECLARE_REFERENCE(char*, string);
 
 } YR_META;
@@ -167,7 +167,6 @@ typedef struct _YR_MATCHES
 #define STRING_FOUND(x) \
     ((x)->matches[yr_get_tidx()].tail != NULL)
 
-
 #define STRING_MATCHES(x) \
     ((x)->matches[yr_get_tidx()])
 
@@ -220,8 +219,8 @@ typedef struct _YR_RULE
   int32_t g_flags;               // Global flags
   int32_t t_flags[MAX_THREADS];  // Thread-specific flags
 
-  DECLARE_REFERENCE(char*, identifier);
-  DECLARE_REFERENCE(char*, tags);
+  DECLARE_REFERENCE(const char*, identifier);
+  DECLARE_REFERENCE(const char*, tags);
   DECLARE_REFERENCE(YR_META*, metas);
   DECLARE_REFERENCE(YR_STRING*, strings);
   DECLARE_REFERENCE(YR_NAMESPACE*, ns);
diff --git a/libyara/parser.c b/libyara/parser.c
index 0d29928..9d75470 100644
--- a/libyara/parser.c
+++ b/libyara/parser.c
@@ -691,7 +691,7 @@ int yr_parser_reduce_rule_declaration(
   FAIL_ON_COMPILER_ERROR(yr_arena_write_string(
       compiler->sz_arena,
       identifier,
-      &rule->identifier));
+      (char**) &rule->identifier));
 
   FAIL_ON_COMPILER_ERROR(yr_parser_emit_with_arg_reloc(
       yyscanner,
@@ -800,7 +800,7 @@ YR_META* yr_parser_reduce_meta_declaration(
   compiler->last_result = yr_arena_write_string(
       compiler->sz_arena,
       identifier,
-      &meta->identifier);
+      (char**) &meta->identifier);
 
   if (compiler->last_result != ERROR_SUCCESS)
     return NULL;
diff --git a/yara.c b/yara.c
index aff7710..fa40d6e 100644
--- a/yara.c
+++ b/yara.c
@@ -452,7 +452,7 @@ int handle_message(int message, YR_RULE* rule, void* data)
   YR_MATCH* match;
   YR_META* meta;
 
-  char* tag_name;
+  const char* tag_name;
   size_t tag_length;
   int is_matching;
   int string_found;

-- 
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