diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-30 18:45:08 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-30 18:45:08 +0000 |
commit | 7566abd1b06e1b046ff2e814fd03584eb4cf33a6 (patch) | |
tree | c0a0355046a033a882439d4d7dd8693119f812b7 | |
parent | 407a45a3b73a6c776dc47ce69cea5f1611a0f3eb (diff) |
Various g++ fixes.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1178 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | src/misc.c | 2 | ||||
-rw-r--r-- | src/modules.c | 72 | ||||
-rw-r--r-- | src/news.c | 32 |
3 files changed, 53 insertions, 53 deletions
diff --git a/src/misc.c b/src/misc.c index d71270fd1..f63e30b65 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1222,7 +1222,7 @@ char **buildStringList(char *src, int *number) do { if (s) { i++; - list = realloc(list, sizeof(char *) * i); + list = (char **)realloc(list, sizeof(char *) * i); list[i - 1] = sstrdup(s); } } while ((s = strtok(NULL, " "))); diff --git a/src/modules.c b/src/modules.c index 99974d2ef..27cef700f 100644 --- a/src/modules.c +++ b/src/modules.c @@ -256,7 +256,7 @@ void modules_delayed_init(void) * And if that isn't enough discouragement, you'll wake up with your * both legs broken tomorrow ;) -GD */ -void modules_unload_all(boolean fini, boolean unload_proto) +void modules_unload_all(bool fini, bool unload_proto) { #ifdef USE_MODULES int idx; @@ -308,7 +308,7 @@ Module *createModule(char *filename) if (!filename) { return NULL; } - if ((m = malloc(sizeof(Module))) == NULL) { + if ((m = (Module *)malloc(sizeof(Module))) == NULL) { fatal("Out of memory!"); } @@ -389,7 +389,7 @@ int addModule(Module * m) lastHash = current; } - if ((newHash = malloc(sizeof(ModuleHash))) == NULL) { + if ((newHash = (ModuleHash *)malloc(sizeof(ModuleHash))) == NULL) { fatal("Out of memory"); } m->time = time(NULL); @@ -912,7 +912,7 @@ Command *createCommand(const char *name, int (*func) (User * u), return NULL; } - if ((c = malloc(sizeof(Command))) == NULL) { + if ((c = (Command *)malloc(sizeof(Command))) == NULL) { fatal("Out of memory!"); } c->name = sstrdup(name); @@ -1271,7 +1271,7 @@ int addCommand(CommandHash * cmdTable[], Command * c, int pos) lastHash = current; } - if ((newHash = malloc(sizeof(CommandHash))) == NULL) { + if ((newHash = (CommandHash *)malloc(sizeof(CommandHash))) == NULL) { fatal("Out of memory"); } newHash->next = NULL; @@ -1397,7 +1397,7 @@ Message *createMessage(const char *name, if (!name || !func) { return NULL; } - if ((m = malloc(sizeof(Message))) == NULL) { + if ((m = (Message *)malloc(sizeof(Message))) == NULL) { fatal("Out of memory!"); } m->name = sstrdup(name); @@ -1497,7 +1497,7 @@ int addMessage(MessageHash * msgTable[], Message * m, int pos) lastHash = current; } - if ((newHash = malloc(sizeof(MessageHash))) == NULL) { + if ((newHash = (MessageHash *)malloc(sizeof(MessageHash))) == NULL) { fatal("Out of memory"); } newHash->next = NULL; @@ -1717,50 +1717,50 @@ int moduleAddCallback(char *name, time_t when, int (*func) (int argc, char *argv[]), int argc, char **argv) { - ModuleCallBack *new, *tmp, *prev; + ModuleCallBack *newcb, *tmp, *prev; int i; - new = malloc(sizeof(ModuleCallBack)); - if (!new) + newcb = (ModuleCallBack *)malloc(sizeof(ModuleCallBack)); + if (!newcb) return MOD_ERR_MEMORY; if (name) - new->name = sstrdup(name); + newcb->name = sstrdup(name); else - new->name = NULL; - new->when = when; + newcb->name = NULL; + newcb->when = when; if (mod_current_module_name) { - new->owner_name = sstrdup(mod_current_module_name); + newcb->owner_name = sstrdup(mod_current_module_name); } else { - new->owner_name = NULL; + newcb->owner_name = NULL; } - new->func = func; - new->argc = argc; - new->argv = malloc(sizeof(char *) * argc); + newcb->func = func; + newcb->argc = argc; + newcb->argv = (char **)malloc(sizeof(char *) * argc); for (i = 0; i < argc; i++) { - new->argv[i] = sstrdup(argv[i]); + newcb->argv[i] = sstrdup(argv[i]); } - new->next = NULL; + newcb->next = NULL; if (moduleCallBackHead == NULL) { - moduleCallBackHead = new; + moduleCallBackHead = newcb; } else { /* find place in list */ tmp = moduleCallBackHead; prev = tmp; - if (new->when < tmp->when) { - new->next = tmp; - moduleCallBackHead = new; + if (newcb->when < tmp->when) { + newcb->next = tmp; + moduleCallBackHead = newcb; } else { - while (tmp && new->when >= tmp->when) { + while (tmp && newcb->when >= tmp->when) { prev = tmp; tmp = tmp->next; } - prev->next = new; - new->next = tmp; + prev->next = newcb; + newcb->next = tmp; } } if (debug) alog("debug: added module CallBack: [%s] due to execute at %ld", - new->name ? new->name : "?", (long int) new->when); + newcb->name ? newcb->name : "?", (long int) newcb->when); return MOD_ERR_OK; } @@ -1817,7 +1817,7 @@ void moduleCallBackDeleteEntry(ModuleCallBack * prev) * @param found have we found it? * @return a pointer to the ModuleCallBack struct or NULL - dont forget to check the found paramter! **/ -ModuleCallBack *moduleCallBackFindEntry(char *mod_name, boolean * found) +ModuleCallBack *moduleCallBackFindEntry(char *mod_name, bool * found) { ModuleCallBack *prev = NULL, *current = NULL; *found = false; @@ -1886,7 +1886,7 @@ void moduleDelCallback(char *name) **/ void moduleCallBackPrepForUnload(char *mod_name) { - boolean found = false; + bool found = false; ModuleCallBack *tmp = NULL; tmp = moduleCallBackFindEntry(mod_name, &found); @@ -2158,7 +2158,7 @@ int moduleAddData(ModuleData ** md, char *key, char *value) moduleDelData(md, key); /* Remove any existing module data for this module with the same key */ - newData = malloc(sizeof(ModuleData)); + newData = (ModuleData *)malloc(sizeof(ModuleData)); if (!newData) { return MOD_ERR_MEMORY; } @@ -2302,7 +2302,7 @@ void moduleDelAllData(ModuleData ** md) **/ void moduleDelAllDataMod(Module * m) { - boolean freeme = false; + bool freeme = false; int i, j; User *user; NickAlias *na; @@ -2381,9 +2381,9 @@ void moduleCleanStruct(ModuleData ** moduleData) * @param build The build revision of anope from SVN * @return True if the version newer than the version specified. **/ -boolean moduleMinVersion(int major, int minor, int patch, int build) +bool moduleMinVersion(int major, int minor, int patch, int build) { - boolean ret = false; + bool ret = false; if (VERSION_MAJOR > major) { /* Def. new */ ret = true; } else if (VERSION_MAJOR == major) { /* Might be newer */ @@ -2580,7 +2580,7 @@ void moduleInsertLanguage(int langNumber, int ac, char **av) mod_current_module->lang[langNumber].argc = ac; mod_current_module->lang[langNumber].argv = - malloc(sizeof(char *) * ac); + (char **)malloc(sizeof(char *) * ac); for (i = 0; i < ac; i++) { mod_current_module->lang[langNumber].argv[i] = sstrdup(av[i]); } @@ -2698,7 +2698,7 @@ void queueModuleOperation(Module *m, ModuleOperation op, User *u) { ModuleQueue *qm; - qm = scalloc(1, sizeof(ModuleQueue)); + qm = (ModuleQueue *)scalloc(1, sizeof(ModuleQueue)); qm->m = m; qm->op = op; qm->u = u; diff --git a/src/news.c b/src/news.c index 45dbbd6b3..0e0dd426a 100644 --- a/src/news.c +++ b/src/news.c @@ -91,13 +91,13 @@ struct newsmsgs msgarray[] = { } }; -static int *findmsgs(int16 type, char **typename) +static int *findmsgs(int16 type, char **type_name) { int i; for (i = 0; i < lenof(msgarray); i++) { if (msgarray[i].type == type) { - if (typename) - *typename = msgarray[i].name; + if (type_name) + *type_name = msgarray[i].name; return msgarray[i].msgs; } } @@ -114,12 +114,12 @@ static void do_news_list(User * u, int16 type, int *msgs); /* Add news items. */ static void do_news_add(User * u, int16 type, int *msgs, - const char *typename); + const char *type_name); static int add_newsitem(User * u, const char *text, int16 type); /* Delete news items. */ static void do_news_del(User * u, int16 type, int *msgs, - const char *typename); + const char *type_name); static int del_newsitem(int num, int16 type); /*************************************************************************/ @@ -172,7 +172,7 @@ void load_news() news_size = 32767; else news_size = 2 * nnews; - news = scalloc(sizeof(*news) * news_size, 1); + news = (NewsItem *)scalloc(sizeof(*news) * news_size, 1); if (!nnews) { close_db(f); return; @@ -362,10 +362,10 @@ void do_news(User * u, short type) { int is_servadmin = is_services_admin(u); char *cmd = strtok(NULL, " "); - char *typename; + char *type_name; int *msgs; - msgs = findmsgs(type, &typename); + msgs = findmsgs(type, &type_name); if (!msgs) { alog("news: Invalid type to do_news()"); return; @@ -378,19 +378,19 @@ void do_news(User * u, short type) do_news_list(u, type, msgs); } else if (stricmp(cmd, "ADD") == 0) { if (is_servadmin) - do_news_add(u, type, msgs, typename); + do_news_add(u, type, msgs, type_name); else notice_lang(s_OperServ, u, PERMISSION_DENIED); } else if (stricmp(cmd, "DEL") == 0) { if (is_servadmin) - do_news_del(u, type, msgs, typename); + do_news_del(u, type, msgs, type_name); else notice_lang(s_OperServ, u, PERMISSION_DENIED); } else { char buf[32]; - snprintf(buf, sizeof(buf), "%sNEWS", typename); + snprintf(buf, sizeof(buf), "%sNEWS", type_name); syntax_error(s_OperServ, u, buf, msgs[MSG_SYNTAX]); } } @@ -431,14 +431,14 @@ static void do_news_list(User * u, int16 type, int *msgs) /* Handle a {LOGON,OPER}NEWS ADD command. */ static void do_news_add(User * u, int16 type, int *msgs, - const char *typename) + const char *type_name) { char *text = strtok(NULL, ""); int n; if (!text) { char buf[32]; - snprintf(buf, sizeof(buf), "%sNEWS", typename); + snprintf(buf, sizeof(buf), "%sNEWS", type_name); syntax_error(s_OperServ, u, buf, msgs[MSG_ADD_SYNTAX]); } else { if (readonly) { @@ -470,7 +470,7 @@ static int add_newsitem(User * u, const char *text, short type) news_size = 8; else news_size *= 2; - news = srealloc(news, sizeof(*news) * news_size); + news = (NewsItem *)srealloc(news, sizeof(*news) * news_size); } num = 0; for (i = nnews - 1; i >= 0; i--) { @@ -493,14 +493,14 @@ static int add_newsitem(User * u, const char *text, short type) /* Handle a {LOGON,OPER}NEWS DEL command. */ static void do_news_del(User * u, int16 type, int *msgs, - const char *typename) + const char *type_name) { char *text = strtok(NULL, " "); int i, num; if (!text) { char buf[32]; - snprintf(buf, sizeof(buf), "%sNEWS", typename); + snprintf(buf, sizeof(buf), "%sNEWS", type_name); syntax_error(s_OperServ, u, buf, msgs[MSG_DEL_SYNTAX]); } else { if (readonly) { |