[asterisk-commits] rizzo: trunk r91952 - /trunk/main/config.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Dec 8 12:05:43 CST 2007
Author: rizzo
Date: Sat Dec 8 12:05:42 2007
New Revision: 91952
URL: http://svn.digium.com/view/asterisk?view=rev&rev=91952
Log:
normalize formatting
Modified:
trunk/main/config.c
Modified: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=91952&r1=91951&r2=91952
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Sat Dec 8 12:05:42 2007
@@ -160,8 +160,7 @@
/* I need to keep track of each config file, and all its inclusions,
so that we can track blank lines in each */
-struct inclfile
-{
+struct inclfile {
char *fname;
int lineno;
};
@@ -171,8 +170,7 @@
char *str = ((struct inclfile*)obj)->fname;
int total;
- for (total=0; *str; str++)
- {
+ for (total=0; *str; str++) {
unsigned int tmp = total;
total <<= 1; /* multiply by 2 */
total += tmp; /* multiply by 3 */
@@ -361,8 +359,7 @@
struct ast_config_include *ast_include_find(struct ast_config *conf, const char *included_file)
{
struct ast_config_include *x;
- for (x=conf->includes;x;x=x->next)
- {
+ for (x=conf->includes;x;x=x->next) {
if (strcmp(x->included_file,included_file) == 0)
return x;
}
@@ -454,18 +451,10 @@
static void move_variables(struct ast_category *old, struct ast_category *new)
{
struct ast_variable *var = old->root;
+
old->root = NULL;
-#if 1
/* we can just move the entire list in a single op */
ast_variable_append(new, var);
-#else
- while (var) {
- struct ast_variable *next = var->next;
- var->next = NULL;
- ast_variable_append(new, var);
- var = next;
- }
-#endif
}
struct ast_category *ast_category_new(const char *name, const char *in_file, int lineno)
@@ -521,6 +510,7 @@
static void ast_destroy_comments(struct ast_category *cat)
{
struct ast_comment *n, *p;
+
for (p=cat->precomments; p; p=n) {
n = p->next;
free(p);
@@ -590,6 +580,7 @@
struct ast_variable *ast_category_root(struct ast_config *config, char *cat)
{
struct ast_category *category = ast_category_get(config, cat);
+
if (category)
return category->root;
return NULL;
@@ -647,6 +638,7 @@
{
struct ast_variable *var;
struct ast_category_template_instance *x = ast_calloc(1,sizeof(struct ast_category_template_instance));
+
strcpy(x->name, base->name);
x->inst = base;
AST_LIST_INSERT_TAIL(&new->template_instances, x, next);
@@ -667,6 +659,7 @@
{
struct ast_variable *cur, *prev=NULL, *curn;
int res = -1;
+
cur = category->root;
while (cur) {
if (cur->name == variable) {
@@ -751,6 +744,7 @@
int ast_category_delete(struct ast_config *cfg, const char *category)
{
struct ast_category *prev=NULL, *cat;
+
cat = cfg->root;
while (cat) {
if (cat->name == category) {
@@ -1409,6 +1403,7 @@
{
char date[256]="";
time_t t;
+
time(&t);
ast_copy_string(date, ctime(&t), sizeof(date));
@@ -1426,6 +1421,7 @@
static void inclfile_destroy(void *obj)
{
const struct inclfile *o = obj;
+
if (o->fname)
free(o->fname);
}
@@ -1459,6 +1455,7 @@
static int count_linefeeds(char *str)
{
int count = 0;
+
while (*str) {
if (*str =='\n')
count++;
@@ -1470,8 +1467,8 @@
static int count_linefeeds_in_comments(struct ast_comment *x)
{
int count = 0;
- while (x)
- {
+
+ while (x) {
count += count_linefeeds(x->cmt);
x = x->next;
}
@@ -2048,7 +2045,6 @@
if (eng)
return 1;
return 0;
-
}
/*! \brief Check if there's any realtime engines loaded */
More information about the asterisk-commits
mailing list