[Forensics-changes] [yara] 213/415: Change "namespace" identifiers to "ns" to avoid conflicts with C++ keyword
Hilko Bengen
bengen at moszumanska.debian.org
Thu Apr 3 05:43:07 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch debian
in repository yara.
commit 48a28f510c7a05737f71d916435b6aa39a813890
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Fri Nov 8 11:10:49 2013 +0000
Change "namespace" identifiers to "ns" to avoid conflicts with C++ keyword
---
libyara/hash.c | 26 +++++++++++++-------------
libyara/hash.h | 4 ++--
libyara/parser.c | 4 ++--
libyara/rules.c | 4 ++--
libyara/yara.h | 4 ++--
yara-python/yara-python.c | 4 ++--
6 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/libyara/hash.c b/libyara/hash.c
index 38add40..5ea80b6 100644
--- a/libyara/hash.c
+++ b/libyara/hash.c
@@ -123,8 +123,8 @@ void yr_hash_table_destroy(
while (entry != NULL)
{
next_entry = entry->next;
- if (entry->namespace != NULL)
- yr_free(entry->namespace);
+ if (entry->ns != NULL)
+ yr_free(entry->ns);
yr_free(entry->key);
yr_free(entry);
entry = next_entry;
@@ -138,15 +138,15 @@ void yr_hash_table_destroy(
void* yr_hash_table_lookup(
HASH_TABLE* table,
const char* key,
- const char* namespace)
+ const char* ns)
{
HASH_TABLE_ENTRY* entry;
uint32_t bucket_index;
bucket_index = hash(0, key, strlen(key));
- if (namespace != NULL)
- bucket_index = hash(bucket_index, namespace, strlen(namespace));
+ if (ns != NULL)
+ bucket_index = hash(bucket_index, ns, strlen(ns));
bucket_index = bucket_index % table->size;
@@ -155,8 +155,8 @@ void* yr_hash_table_lookup(
while (entry != NULL)
{
if (strcmp(entry->key, key) == 0 &&
- (entry->namespace == namespace ||
- strcmp(entry->namespace, namespace) == 0))
+ (entry->ns == ns ||
+ strcmp(entry->ns, ns) == 0))
{
return entry->value;
}
@@ -170,7 +170,7 @@ void* yr_hash_table_lookup(
int yr_hash_table_add(
HASH_TABLE* table,
const char* key,
- const char* namespace,
+ const char* ns,
void* value)
{
HASH_TABLE_ENTRY* entry;
@@ -189,16 +189,16 @@ int yr_hash_table_add(
return ERROR_INSUFICIENT_MEMORY;
}
- if (namespace != NULL)
- entry->namespace = yr_strdup(namespace);
+ if (ns != NULL)
+ entry->ns = yr_strdup(ns);
else
- entry->namespace = NULL;
+ entry->ns = NULL;
entry->value = value;
bucket_index = hash(0, key, strlen(key));
- if (namespace != NULL)
- bucket_index = hash(bucket_index, namespace, strlen(namespace));
+ if (ns != NULL)
+ bucket_index = hash(bucket_index, ns, strlen(ns));
bucket_index = bucket_index % table->size;
diff --git a/libyara/hash.h b/libyara/hash.h
index 5b76f9a..b5b6605 100644
--- a/libyara/hash.h
+++ b/libyara/hash.h
@@ -31,13 +31,13 @@ void yr_hash_table_destroy(
void* yr_hash_table_lookup(
HASH_TABLE* table,
const char* key,
- const char* namespace);
+ const char* ns);
int yr_hash_table_add(
HASH_TABLE* table,
const char* key,
- const char* namespace,
+ const char* ns,
void* value);
#endif
diff --git a/libyara/parser.c b/libyara/parser.c
index e028146..4e8a130 100644
--- a/libyara/parser.c
+++ b/libyara/parser.c
@@ -508,7 +508,7 @@ int yr_parser_reduce_rule_declaration(
offsetof(RULE, tags),
offsetof(RULE, strings),
offsetof(RULE, metas),
- offsetof(RULE, namespace),
+ offsetof(RULE, ns),
EOL);
if (compiler->last_result != ERROR_SUCCESS)
@@ -535,7 +535,7 @@ int yr_parser_reduce_rule_declaration(
rule->tags = tags;
rule->strings = strings;
rule->metas = metas;
- rule->namespace = compiler->current_namespace;
+ rule->ns = compiler->current_namespace;
compiler->current_rule_flags = 0;
compiler->current_rule_strings = NULL;
diff --git a/libyara/rules.c b/libyara/rules.c
index a63f089..49ee5f6 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -779,7 +779,7 @@ int yr_rules_scan_mem_blocks(
{
if (RULE_IS_GLOBAL(rule) && !(rule->t_flags[tidx] & RULE_TFLAGS_MATCH))
{
- rule->namespace->t_flags[tidx] |= NAMESPACE_TFLAGS_UNSATISFIED_GLOBAL;
+ rule->ns->t_flags[tidx] |= NAMESPACE_TFLAGS_UNSATISFIED_GLOBAL;
}
rule++;
@@ -790,7 +790,7 @@ int yr_rules_scan_mem_blocks(
while (!RULE_IS_NULL(rule))
{
if (rule->t_flags[tidx] & RULE_TFLAGS_MATCH &&
- !(rule->namespace->t_flags[tidx] & NAMESPACE_TFLAGS_UNSATISFIED_GLOBAL))
+ !(rule->ns->t_flags[tidx] & NAMESPACE_TFLAGS_UNSATISFIED_GLOBAL))
{
message = CALLBACK_MSG_RULE_MATCHING;
}
diff --git a/libyara/yara.h b/libyara/yara.h
index d307629..34a4d65 100644
--- a/libyara/yara.h
+++ b/libyara/yara.h
@@ -360,7 +360,7 @@ typedef struct _RULE
DECLARE_REFERENCE(char*, tags);
DECLARE_REFERENCE(META*, metas);
DECLARE_REFERENCE(STRING*, strings);
- DECLARE_REFERENCE(NAMESPACE*, namespace);
+ DECLARE_REFERENCE(NAMESPACE*, ns);
} RULE;
@@ -453,7 +453,7 @@ typedef struct _YARA_RULES_FILE_HEADER
typedef struct _HASH_TABLE_ENTRY
{
char* key;
- char* namespace;
+ char* ns;
void* value;
struct _HASH_TABLE_ENTRY* next;
diff --git a/yara-python/yara-python.c b/yara-python/yara-python.c
index dfe645c..3ba906e 100644
--- a/yara-python/yara-python.c
+++ b/yara-python/yara-python.c
@@ -393,7 +393,7 @@ int yara_callback(
{
match = Match_NEW(
rule->identifier,
- rule->namespace->name,
+ rule->ns->name,
tag_list,
meta_list,
string_list);
@@ -428,7 +428,7 @@ int yara_callback(
PyDict_SetItemString(callback_dict, "rule", object);
Py_DECREF(object);
- object = PY_STRING(rule->namespace->name);
+ object = PY_STRING(rule->ns->name);
PyDict_SetItemString(callback_dict, "namespace", object);
Py_DECREF(object);
--
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