summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-05-07 13:01:41 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2011-05-07 13:14:41 +0200
commit1b4a42c3b1e5633f523df08589c3cadc65aca6e3 (patch)
tree78a5e4135a7bb8fa50ee789a2b61b53944bd10af
parent2c34867fc3250186474c1f1c3a20c2a01285e974 (diff)
msgfile: use namespace prefix osmo_* and use more descriptive names
Summary of changes: s/msg_entry/osmo_config_entry/g s/msg_entries/osmo_config_list/g s/msg_entry_parse/osmo_config_list_parse/g minor glitch included in this patch while I was at it: -#include "linuxlist.h" +#include <osmocom/core/linuxlist.h>
-rw-r--r--include/osmocom/core/msgfile.h8
-rw-r--r--src/msgfile.c22
-rw-r--r--tests/msgfile/msgfile_test.c8
3 files changed, 20 insertions, 18 deletions
diff --git a/include/osmocom/core/msgfile.h b/include/osmocom/core/msgfile.h
index 92caa9fc..c5e67a45 100644
--- a/include/osmocom/core/msgfile.h
+++ b/include/osmocom/core/msgfile.h
@@ -22,12 +22,12 @@
#ifndef MSG_FILE_H
#define MSG_FILE_H
-#include "linuxlist.h"
+#include <osmocom/core/linuxlist.h>
/**
* One message in the list.
*/
-struct msg_entry {
+struct osmo_config_entry {
struct llist_head list;
/* number for everyone to use */
@@ -40,10 +40,10 @@ struct msg_entry {
char *text;
};
-struct msg_entries {
+struct osmo_config_list {
struct llist_head entry;
};
-struct msg_entries *msg_entry_parse(void *ctx, const char *filename);
+struct osmo_config_list* osmo_config_list_parse(void *ctx, const char *filename);
#endif
diff --git a/src/msgfile.c b/src/msgfile.c
index c13df51d..d2b180d7 100644
--- a/src/msgfile.c
+++ b/src/msgfile.c
@@ -29,11 +29,13 @@
#include <unistd.h>
#include <string.h>
-static struct msg_entry *alloc_entry(struct msg_entries *entries,
- const char *mcc, const char *mnc,
- const char *option, const char *text)
+static struct osmo_config_entry *
+alloc_entry(struct osmo_config_list *entries,
+ const char *mcc, const char *mnc,
+ const char *option, const char *text)
{
- struct msg_entry *entry = talloc_zero(entries, struct msg_entry);
+ struct osmo_config_entry *entry =
+ talloc_zero(entries, struct osmo_config_entry);
if (!entry)
return NULL;
@@ -46,11 +48,11 @@ static struct msg_entry *alloc_entry(struct msg_entries *entries,
return entry;
}
-static struct msg_entries *alloc_entries(void *ctx)
+static struct osmo_config_list *alloc_entries(void *ctx)
{
- struct msg_entries *entries;
+ struct osmo_config_list *entries;
- entries = talloc_zero(ctx, struct msg_entries);
+ entries = talloc_zero(ctx, struct osmo_config_list);
if (!entries)
return NULL;
@@ -61,7 +63,7 @@ static struct msg_entries *alloc_entries(void *ctx)
/*
* split a line like 'foo:Text'.
*/
-static void handle_line(struct msg_entries *entries, char *line)
+static void handle_line(struct osmo_config_list *entries, char *line)
{
int i;
const int len = strlen(line);
@@ -91,9 +93,9 @@ static void handle_line(struct msg_entries *entries, char *line)
/* nothing found */
}
-struct msg_entries *msg_entry_parse(void *ctx, const char *filename)
+struct osmo_config_list *osmo_config_list_parse(void *ctx, const char *filename)
{
- struct msg_entries *entries;
+ struct osmo_config_list *entries;
size_t n;
char *line;
FILE *file;
diff --git a/tests/msgfile/msgfile_test.c b/tests/msgfile/msgfile_test.c
index 4637ceab..ed7aa978 100644
--- a/tests/msgfile/msgfile_test.c
+++ b/tests/msgfile/msgfile_test.c
@@ -23,9 +23,9 @@
#include <stdio.h>
-static void dump_entries(struct msg_entries *entries)
+static void dump_entries(struct osmo_config_list *entries)
{
- struct msg_entry *entry;
+ struct osmo_config_entry *entry;
if (!entries) {
fprintf(stderr, "Failed to parse the file\n");
@@ -40,10 +40,10 @@ static void dump_entries(struct msg_entries *entries)
int main(int argc, char **argv)
{
- struct msg_entries *entries;
+ struct osmo_config_list *entries;
/* todo use msgfile_test.c.in and replace the path */
- entries = msg_entry_parse(NULL, "msgconfig.cfg");
+ entries = osmo_config_list_parse(NULL, "msgconfig.cfg");
dump_entries(entries);
return 0;