aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormvanbaak <mvanbaak@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-19 20:48:33 +0000
committermvanbaak <mvanbaak@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-19 20:48:33 +0000
commitc342cdeaf3a971c5df904b312539c7c3082c60f5 (patch)
tree7b42274bee0dd9b38bbd91570bf09a13d1c6aef0 /apps
parentf06c83d2c47969db738a3f45b729e6c9906bbbd5 (diff)
Older versions of GNU gcc do not allow 'NULL' as sentinel.
They want (char *)NULL as sentinel. An example is OpenBSD (confirmed on 4.3) that ships with gcc 3.3.4 This commit introduces a contstant SENTINEL which is declared as: #define SENTINEL ((char *)NULL) All places I could test compile on my openbsd system are converted. Update CODING-GUIDELINES to tell about this constant. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@124127 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_directory.c2
-rw-r--r--apps/app_minivm.c2
-rw-r--r--apps/app_queue.c14
-rw-r--r--apps/app_voicemail.c34
4 files changed, 26 insertions, 26 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index eb50336ec..f85dbeb11 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -366,7 +366,7 @@ static struct ast_config *realtime_directory(char *context)
/* Get realtime entries, categorized by their mailbox number
and present in the requested context */
- rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", context, NULL);
+ rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", context, SENTINEL);
/* if there are no results, just return the entries from the config file */
if (!rtdata)
diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index 8746aca5b..8b507ddd7 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -863,7 +863,7 @@ static struct minivm_account *find_user_realtime(const char *domain, const char
ast_copy_string(retval->username, username, sizeof(retval->username));
populate_defaults(retval);
- var = ast_load_realtime("minivm", "username", username, "domain", domain, NULL);
+ var = ast_load_realtime("minivm", "username", username, "domain", domain, SENTINEL);
if (!var) {
ast_free(retval);
diff --git a/apps/app_queue.c b/apps/app_queue.c
index da77facac..ae31a5af7 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1578,9 +1578,9 @@ static struct call_queue *load_realtime_queue(const char *queuename)
Thus we might see an empty member list when a queue is
deleted. In practise, this is unlikely to cause a problem. */
- queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
+ queue_vars = ast_load_realtime("queues", "name", queuename, SENTINEL);
if (queue_vars) {
- member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
+ member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, SENTINEL);
if (!member_config) {
ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
ast_variables_destroy(queue_vars);
@@ -1609,7 +1609,7 @@ static int update_realtime_member_field(struct member *mem, const char *queue_na
if (ast_strlen_zero(mem->rt_uniqueid))
return ret;
- if ((ast_update_realtime("queue_members", "uniqueid", mem->rt_uniqueid, field, value, NULL)) > 0)
+ if ((ast_update_realtime("queue_members", "uniqueid", mem->rt_uniqueid, field, value, SENTINEL)) > 0)
ret = 0;
return ret;
@@ -1623,7 +1623,7 @@ static void update_realtime_members(struct call_queue *q)
char *interface = NULL;
struct ao2_iterator mem_iter;
- if (!(member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL))) {
+ if (!(member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , SENTINEL))) {
/*This queue doesn't have realtime members*/
ast_debug(3, "Queue %s has no realtime members defined. No need for update\n", q->name);
return;
@@ -1982,7 +1982,7 @@ static void leave_queue(struct queue_ent *qe)
/*If the queue is a realtime queue, check to see if it's still defined in real time*/
if (q->realtime) {
- if (!ast_load_realtime("queues", "name", q->name, NULL))
+ if (!ast_load_realtime("queues", "name", q->name, SENTINEL))
q->dead = 1;
}
@@ -4949,7 +4949,7 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, const char
count = q->count;
ao2_unlock(q);
queue_unref(q);
- } else if ((var = ast_load_realtime("queues", "name", data, NULL))) {
+ } else if ((var = ast_load_realtime("queues", "name", data, SENTINEL))) {
/* if the queue is realtime but was not found in memory, this
* means that the queue had been deleted from memory since it was
* "dead." This means it has a 0 waiting count
@@ -6436,7 +6436,7 @@ static int load_module(void)
res = -1;
}
- ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, NULL);
+ ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, SENTINEL);
return res ? AST_MODULE_LOAD_DECLINE : 0;
}
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index e6c56395a..672a3e6bd 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -930,9 +930,9 @@ static int change_password_realtime(struct ast_vm_user *vmu, const char *passwor
int res;
if (!ast_strlen_zero(vmu->uniqueid)) {
if (strlen(password) > 10) {
- ast_realtime_require_field("voicemail", "password", RQ_CHAR, strlen(password), NULL);
+ ast_realtime_require_field("voicemail", "password", RQ_CHAR, strlen(password), SENTINEL);
}
- res = ast_update_realtime("voicemail", "uniqueid", vmu->uniqueid, "password", password, NULL);
+ res = ast_update_realtime("voicemail", "uniqueid", vmu->uniqueid, "password", password, SENTINEL);
if (res > 0) {
ast_copy_string(vmu->password, password, sizeof(vmu->password));
res = 0;
@@ -1044,9 +1044,9 @@ static struct ast_vm_user *find_user_realtime(struct ast_vm_user *ivm, const cha
ast_copy_string(retval->mailbox, mailbox, sizeof(retval->mailbox));
populate_defaults(retval);
if (!context && ast_test_flag((&globalflags), VM_SEARCH))
- var = ast_load_realtime("voicemail", "mailbox", mailbox, NULL);
+ var = ast_load_realtime("voicemail", "mailbox", mailbox, SENTINEL);
else
- var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", context, NULL);
+ var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", context, SENTINEL);
if (var) {
apply_options_full(retval, var);
ast_variables_destroy(var);
@@ -1520,7 +1520,7 @@ static int remove_file(char *dir, int msgnum)
ast_copy_string(fn, dir, sizeof(fn));
ast_filedelete(fn, NULL);
if (ast_check_realtime("voicemail_data")) {
- ast_destroy_realtime("voicemail_data", "filename", fn, NULL);
+ ast_destroy_realtime("voicemail_data", "filename", fn, SENTINEL);
}
snprintf(full_fn, sizeof(full_fn), "%s.txt", fn);
unlink(full_fn);
@@ -1986,7 +1986,7 @@ static void rename_file(char *sfn, char *dfn)
snprintf(stxt, sizeof(stxt), "%s.txt", sfn);
snprintf(dtxt, sizeof(dtxt), "%s.txt", dfn);
if (ast_check_realtime("voicemail_data")) {
- ast_update_realtime("voicemail_data", "filename", sfn, "filename", dfn, NULL);
+ ast_update_realtime("voicemail_data", "filename", sfn, "filename", dfn, SENTINEL);
}
rename(stxt, dtxt);
}
@@ -2108,7 +2108,7 @@ static void copy_plain_file(char *frompath, char *topath)
snprintf(frompath2, sizeof(frompath2), "%s.txt", frompath);
snprintf(topath2, sizeof(topath2), "%s.txt", topath);
if (ast_check_realtime("voicemail_data")) {
- var = ast_load_realtime("voicemail_data", "filename", frompath, NULL);
+ var = ast_load_realtime("voicemail_data", "filename", frompath, SENTINEL);
/* This cycle converts ast_variable linked list, to va_list list of arguments, may be there is a better way to do it? */
for (tmp = var; tmp; tmp = tmp->next) {
if (!strcasecmp(tmp->name, "origmailbox")) {
@@ -2135,7 +2135,7 @@ static void copy_plain_file(char *frompath, char *topath)
duration = tmp->value;
}
}
- ast_store_realtime("voicemail_data", "filename", topath, "origmailbox", origmailbox, "context", context, "macrocontext", macrocontext, "exten", exten, "priority", priority, "callerchan", callerchan, "callerid", callerid, "origdate", origdate, "origtime", origtime, "category", category, "duration", duration, NULL);
+ ast_store_realtime("voicemail_data", "filename", topath, "origmailbox", origmailbox, "context", context, "macrocontext", macrocontext, "exten", exten, "priority", priority, "callerchan", callerchan, "callerid", callerid, "origdate", origdate, "origtime", origtime, "category", category, "duration", duration, SENTINEL);
}
copy(frompath2, topath2);
ast_variables_destroy(var);
@@ -2163,7 +2163,7 @@ static int vm_delete(char *file)
* but trying to eliminate all sprintf's anyhow
*/
if (ast_check_realtime("voicemail_data")) {
- ast_destroy_realtime("voicemail_data", "filename", file, NULL);
+ ast_destroy_realtime("voicemail_data", "filename", file, SENTINEL);
}
snprintf(txt, txtsize, "%s.txt", file);
unlink(txt);
@@ -4013,7 +4013,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
snprintf(priority, sizeof(priority), "%d", chan->priority);
snprintf(origtime, sizeof(origtime), "%ld", (long)time(NULL));
get_date(date, sizeof(date));
- rtmsgid = ast_store_realtime("voicemail_data", "origmailbox", ext, "context", chan->context, "macrocontext", chan->macrocontext, "exten", chan->exten, "priority", priority, "callerchan", chan->name, "callerid", ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"), "origdate", date, "origtime", origtime, "category", S_OR(category,""), NULL);
+ rtmsgid = ast_store_realtime("voicemail_data", "origmailbox", ext, "context", chan->context, "macrocontext", chan->macrocontext, "exten", chan->exten, "priority", priority, "callerchan", chan->name, "callerid", ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"), "origdate", date, "origtime", origtime, "category", S_OR(category,""), SENTINEL);
}
/* Store information */
@@ -4062,7 +4062,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
unlink(tmptxtfile);
if (ast_check_realtime("voicemail_data")) {
snprintf(tmpid, sizeof(tmpid), "%d", rtmsgid);
- ast_destroy_realtime("voicemail_data", "id", tmpid, NULL);
+ ast_destroy_realtime("voicemail_data", "id", tmpid, SENTINEL);
}
} else {
fprintf(txt, "duration=%d\n", duration);
@@ -4078,7 +4078,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
ast_unlock_path(dir);
if (ast_check_realtime("voicemail_data")) {
snprintf(tmpid, sizeof(tmpid), "%d", rtmsgid);
- ast_destroy_realtime("voicemail_data", "id", tmpid, NULL);
+ ast_destroy_realtime("voicemail_data", "id", tmpid, SENTINEL);
}
} else {
#ifndef IMAP_STORAGE
@@ -4106,7 +4106,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
if (ast_check_realtime("voicemail_data")) {
snprintf(tmpid, sizeof(tmpid), "%d", rtmsgid);
snprintf(tmpdur, sizeof(tmpdur), "%d", duration);
- ast_update_realtime("voicemail_data", "id", tmpid, "filename", fn, "duration", tmpdur, NULL);
+ ast_update_realtime("voicemail_data", "id", tmpid, "filename", fn, "duration", tmpdur, SENTINEL);
}
/* We must store the file first, before copying the message, because
* ODBC storage does the entire copy with SQL.
@@ -8884,7 +8884,7 @@ static char *show_users_realtime(int fd, const char *context)
const char *cat = NULL;
if (!(cfg = ast_load_realtime_multientry("voicemail",
- "context", context, NULL))) {
+ "context", context, SENTINEL))) {
return CLI_FAILURE;
}
@@ -10098,8 +10098,8 @@ static int load_module(void)
ast_cli_register_multiple(cli_voicemail, sizeof(cli_voicemail) / sizeof(struct ast_cli_entry));
ast_install_vm_functions(has_voicemail, inboxcount, messagecount, sayname);
- ast_realtime_require_field("voicemail", "uniqueid", RQ_UINTEGER3, 11, "password", RQ_CHAR, 10, NULL);
- ast_realtime_require_field("voicemail_data", "filename", RQ_CHAR, 30, "duration", RQ_UINTEGER3, 5, NULL);
+ ast_realtime_require_field("voicemail", "uniqueid", RQ_UINTEGER3, 11, "password", RQ_CHAR, 10, SENTINEL);
+ ast_realtime_require_field("voicemail_data", "filename", RQ_CHAR, 30, "duration", RQ_UINTEGER3, 5, SENTINEL);
return res;
}
@@ -10691,7 +10691,7 @@ static struct ast_vm_user *find_user_realtime_imapuser(const char *imapuser)
ast_set_flag(vmu, VM_ALLOCED);
populate_defaults(vmu);
- var = ast_load_realtime("voicemail", "imapuser", imapuser, NULL);
+ var = ast_load_realtime("voicemail", "imapuser", imapuser, SENTINEL);
if (var) {
apply_options_full(vmu, var);
ast_variables_destroy(var);