Simplify last lib/idr.c change
PATCH 1/1 Simplify last lib/idr.c change
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The last change to alloc_layer in lib/idr.c unnecessarily complicates the code and depending on the definition of spin_unlock will cause worse code to be generated than necessary. The following patch should improve the situation.
- --- lib/idr.c-old 2004-09-22 23:02:15.000000000 -0700
+++ lib/idr.c 2004-09-22 23:03:06.000000000 -0700
@@ -39,13 +39,11 @@ static struct idr_layer *alloc_layer(str
struct idr_layer *p;
spin_lock(&idp->lock);
- - if (!(p = idp->id_free)) {
- - spin_unlock(&idp->lock);
- - return NULL;
+ if ((p = idp->id_free)) {
+ idp->id_free = p->ary[0];
+ idp->id_free_cnt--;
+ p->ary[0] = NULL;
}
- - idp->id_free = p->ary[0];
- - idp->id_free_cnt--;
- - p->ary[0] = NULL;
spin_unlock(&idp->lock);
return(p);
}
- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖ -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQFBUmfk2ijCOnn/RHQRAvJ4AKCpd1bkrRkcHaDm+mDyfh1tMpj9EgCgqu2N voeHnNuVH5cpBCDtafFjZoc=
=XUFL
-----END PGP SIGNATURE-----