summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2013-03-04 19:44:25 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2013-03-04 19:44:25 (GMT)
commita75760ff7d9bedcb1377fc3441f5e38178da1d6a (patch) (side-by-side diff)
tree39413a06ee259848dfc2cb585a357ddac5d2d4ca
parent860ec4960ff61cf3b2e98e0d020e7f8a93a56008 (diff)
downloadalck-a75760ff7d9bedcb1377fc3441f5e38178da1d6a.tar.gz
alck-a75760ff7d9bedcb1377fc3441f5e38178da1d6a.tar.bz2
Switch to a "right" style.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ckaliases.c53
-rw-r--r--gram.y28
-rw-r--r--lex.l12
3 files changed, 31 insertions, 62 deletions
diff --git a/ckaliases.c b/ckaliases.c
index d77e62d..da0a5c1 100644
--- a/ckaliases.c
+++ b/ckaliases.c
@@ -50,23 +50,18 @@ TC (unsigned *R, int n)
cword = R;
mask = 1;
rowi = R;
- while (rowi < relend)
- {
+ while (rowi < relend) {
ccol = cword;
rowj = R;
- while (rowj < relend)
- {
- if (*ccol & mask)
- {
+ while (rowj < relend) {
+ if (*ccol & mask) {
rp = rowi;
rend = (unsigned *) ((char *) rowj + rowsize);
while (rowj < rend)
*rowj++ |= *rp++;
- }
- else
- {
+ } else {
rowj = (unsigned *) ((char *) rowj + rowsize);
}
@@ -74,8 +69,7 @@ TC (unsigned *R, int n)
}
mask <<= 1;
- if (mask == 0)
- {
+ if (mask == 0) {
mask = 1;
cword++;
}
@@ -91,19 +85,15 @@ slist_add (SLIST **plist, char *str)
p->str = str;
p->next = NULL;
- if (!*plist)
- {
+ if (!*plist) {
*plist = xmalloc (sizeof (**plist));
(*plist)->head = NULL;
}
- if ((*plist)->head == NULL)
- {
+ if ((*plist)->head == NULL) {
(*plist)->head = p;
(*plist)->count = 0;
- }
- else
- {
+ } else {
(*plist)->tail->next = p;
(*plist)->count++;
}
@@ -115,8 +105,7 @@ slist_append (SLIST **pdst, SLIST *src)
{
struct string_list *tail;
- if (!*pdst)
- {
+ if (!*pdst) {
*pdst = xmalloc (sizeof (**pdst));
(*pdst)->head = NULL;
(*pdst)->count = 0;
@@ -151,8 +140,7 @@ slist_destroy (SLIST **plist)
if (!plist || !*plist)
return;
p = (*plist)->head;
- while (p)
- {
+ while (p) {
struct string_list *next = p->next;
free (p);
p = next;
@@ -162,8 +150,7 @@ slist_destroy (SLIST **plist)
}
-typedef struct
-{
+typedef struct {
char *name;
SLIST *exp;
} ALIAS;
@@ -227,8 +214,7 @@ end_aliases ()
aliases = obstack_finish (&alias_stk);
qsort (aliases, alias_count, sizeof aliases[0], alias_cmp);
for (i = 1; i < alias_count; i++)
- if (alias_cmp (aliases + i - 1, aliases + i) == 0)
- {
+ if (alias_cmp(aliases + i - 1, aliases + i) == 0) {
error (0, 0, "alias `%s' multiply defined", aliases[i].name);
error_count++;
}
@@ -266,13 +252,10 @@ mark_connected (unsigned *r, unsigned size)
{
int i;
- for (i = 0; i < alias_count; i++)
- {
- if (aliases[i].exp)
- {
+ for (i = 0; i < alias_count; i++) {
+ if (aliases[i].exp) {
struct string_list *p;
- for (p = aliases[i].exp->head; p; p = p->next)
- {
+ for (p = aliases[i].exp->head; p; p = p->next) {
int n = find_alias (p->str);
if (n >= 0)
alias_setbit (r, size, i, n);
@@ -286,10 +269,8 @@ check_circular_deps (unsigned *r, unsigned size)
{
int i;
- for (i = 0; i < alias_count; i++)
- {
- if (alias_bitisset (r, size, i, i))
- {
+ for (i = 0; i < alias_count; i++) {
+ if (alias_bitisset(r, size, i, i)) {
error (0, 0, "%s: circular dependency", aliases[i].name);
error_count++;
}
diff --git a/gram.y b/gram.y
index dd323be..34d46e2 100644
--- a/gram.y
+++ b/gram.y
@@ -79,8 +79,7 @@ emails: email
email : string
{
- if (restricted && ($1[0] == '|' || $1[0] == '/'))
- {
+ if (restricted && ($1[0] == '|' || $1[0] == '/')) {
yyerror ("Construct not allowed");
YYERROR;
}
@@ -94,8 +93,7 @@ email : string
}
| INCLUDE string
{
- if (restricted)
- {
+ if (restricted) {
yyerror ("Include statement is not allowed");
YYERROR;
}
@@ -169,10 +167,9 @@ main (int argc, char **argv)
begin_aliases ();
init_lex ();
program_name = argv[0];
- while ((c = getopt_long (argc, argv, "-d:f:hp:ruvw:", options, NULL)) != EOF)
- {
- switch (c)
- {
+ while ((c = getopt_long(argc, argv, "-d:f:hp:ruvw:",
+ options, NULL)) != EOF) {
+ switch (c) {
case 1:
if (!cw_list)
read_include (&cw_list, cwfile);
@@ -182,10 +179,8 @@ main (int argc, char **argv)
break;
case 'd':
- for (p = optarg; *p; p++)
- {
- switch (*p)
- {
+ for (p = optarg; *p; p++) {
+ switch (*p) {
case '-':
true = 0;
break;
@@ -213,10 +208,8 @@ main (int argc, char **argv)
read_include (&cw_list, cwfile);
file_list = NULL;
read_include (&file_list, optarg);
- if (file_list)
- {
- for (s = file_list->head; s; s = s->next)
- {
+ if (file_list) {
+ for (s = file_list->head; s; s = s->next) {
openaliases_prefix (optarg, s->str);
yyparse ();
file_count++;
@@ -261,8 +254,7 @@ main (int argc, char **argv)
if (!cw_list)
read_include (&cw_list, cwfile);
- while (argc--)
- {
+ while (argc--) {
openaliases (*argv++);
yyparse ();
file_count++;
diff --git a/lex.l b/lex.l
index ba48a9c..c71d4b9 100644
--- a/lex.l
+++ b/lex.l
@@ -96,8 +96,7 @@ unescape_char (int c)
{
char *p;
- for (p = escape_transtab; *p; p += 2)
- {
+ for (p = escape_transtab; *p; p += 2) {
if (*p == c)
return p[1];
}
@@ -150,8 +149,7 @@ openaliases_prefix (char *prefix, char *name)
if (stat (prefix, &st))
error (1, errno, "cannot stat `%s'", prefix);
- if (!S_ISDIR (st.st_mode))
- {
+ if (!S_ISDIR(st.st_mode)) {
char *p = strrchr (prefix, '/');
if (p)
*p = 0;
@@ -183,8 +181,7 @@ read_include (SLIST **plist, char *name)
char buffer[256];
FILE *fp = fopen (name, "r");
- if (!fp)
- {
+ if (!fp) {
error_at_line (0, 0, file_name, line_num,
"cannot open include file `%s': %s",
name, strerror (errno));
@@ -192,8 +189,7 @@ read_include (SLIST **plist, char *name)
return;
}
- while (p = fgets (buffer, sizeof buffer, fp))
- {
+ while (p = fgets(buffer, sizeof buffer, fp)) {
char *q;
while (*p && isspace (*p))

Return to:

Send suggestions and report system problems to the System administrator.