PERFORCE change 142380 for review
Paolo Pisati
piso at FreeBSD.org
Tue May 27 10:18:42 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=142380
Change 142380 by piso at piso_ferret on 2008/05/27 10:17:55
-Style fixes
-Safer variables initialization
Affected files ...
.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_mod.c#30 edit
Differences ...
==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_mod.c#30 (text+ko) ====
@@ -133,9 +133,10 @@
static int
_attach_handler(struct proto_handler *p)
{
- struct proto_handler *b = NULL;
+ struct proto_handler *b;
- LIBALIAS_WLOCK_ASSERT();
+ LIBALIAS_WLOCK_ASSERT();
+ b = NULL;
LIST_FOREACH(b, &handler_chain, entries) {
if ((b->pri == p->pri) &&
(b->dir == p->dir) &&
@@ -172,10 +173,11 @@
int
LibAliasAttachHandlers(struct proto_handler *_p)
{
- int i, error = -1;
+ int i, error;
LIBALIAS_WLOCK();
- for (i=0; 1; i++) {
+ error = -1;
+ for (i = 0; 1; i++) {
if (*((int *)&_p[i]) == EOH)
break;
error = _attach_handler(&_p[i]);
@@ -189,10 +191,11 @@
int
LibAliasDetachHandlers(struct proto_handler *_p)
{
- int i, error = -1;
+ int i, error;
LIBALIAS_WLOCK();
- for (i=0; 1; i++) {
+ error = -1;
+ for (i = 0; 1; i++) {
if (*((int *)&_p[i]) == EOH)
break;
error = _detach_handler(&_p[i]);
@@ -206,9 +209,10 @@
int
detach_handler(struct proto_handler *_p)
{
- int error = -1;
+ int error;
LIBALIAS_WLOCK();
+ error = -1;
error = _detach_handler(_p);
LIBALIAS_WUNLOCK();
return (error);
@@ -216,13 +220,13 @@
int
find_handler(int8_t dir, int8_t proto, struct libalias *la, struct ip *pip,
- struct alias_data *ad)
+ struct alias_data *ad)
{
struct proto_handler *p;
- int error = ENOENT;
+ int error;
LIBALIAS_RLOCK();
-
+ error = ENOENT;
LIST_FOREACH(p, &handler_chain, entries) {
if ((p->dir & dir) && (p->proto & proto))
if (p->fingerprint(la, pip, ad) == 0) {
@@ -259,9 +263,11 @@
void *
detach_dll(char *p)
{
- struct dll *b = NULL, *b_tmp;
- void *error = NULL;
+ struct dll *b, *b_tmp;
+ void *error;
+ b = NULL;
+ error = NULL;
SLIST_FOREACH_SAFE(b, &dll_chain, next, b_tmp)
if (!strncmp(b->name, p, DLL_LEN)) {
SLIST_REMOVE(&dll_chain, b, dll, next);
More information about the p4-projects
mailing list