Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164703510
D54454.id168876.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D54454.id168876.diff
View Options
diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c
--- a/lib/libgeom/geom_xml2tree.c
+++ b/lib/libgeom/geom_xml2tree.c
@@ -36,6 +36,7 @@
#include <sys/stat.h>
#include <sys/sysctl.h>
+#include <assert.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
@@ -358,14 +359,47 @@
}
static void *
-geom_lookupidptr(struct gmesh *gmp, const void *id)
+geom_lookup_class(const struct gmesh *gmp, const void *id)
{
struct gident *gip;
- gip = geom_lookupid(gmp, id);
- if (gip)
- return (gip->lg_ptr);
- return (NULL);
+ if ((gip = geom_lookupid(gmp, id)) == NULL)
+ return (NULL);
+ assert(gip->lg_what == ISCLASS);
+ return (gip->lg_ptr);
+}
+
+static void *
+geom_lookup_geom(const struct gmesh *gmp, const void *id)
+{
+ struct gident *gip;
+
+ if ((gip = geom_lookupid(gmp, id)) == NULL)
+ return (NULL);
+ assert(gip->lg_what == ISGEOM);
+ return (gip->lg_ptr);
+}
+
+static void *
+geom_lookup_provider(const struct gmesh *gmp, const void *id)
+{
+ struct gident *gip;
+
+ if ((gip = geom_lookupid(gmp, id)) == NULL)
+ return (NULL);
+ assert(gip->lg_what == ISPROVIDER);
+ return (gip->lg_ptr);
+}
+
+static void * __unused
+geom_lookup_consumer(const struct gmesh *gmp, const void *id)
+{
+ struct gident *gip;
+
+ if ((gip = geom_lookupid(gmp, id)) == NULL)
+ return (NULL);
+ assert(gip->lg_what == ISCONSUMER);
+ return (gip->lg_ptr);
}
int
@@ -441,15 +475,15 @@
/* Substitute all identifiers */
LIST_FOREACH(cl, &gmp->lg_class, lg_class) {
LIST_FOREACH(ge, &cl->lg_geom, lg_geom) {
- ge->lg_class = geom_lookupidptr(gmp, ge->lg_class);
+ ge->lg_class = geom_lookup_class(gmp, ge->lg_class);
LIST_FOREACH(pr, &ge->lg_provider, lg_provider) {
- pr->lg_geom = geom_lookupidptr(gmp, pr->lg_geom);
+ pr->lg_geom = geom_lookup_geom(gmp, pr->lg_geom);
}
LIST_FOREACH(co, &ge->lg_consumer, lg_consumer) {
- co->lg_geom = geom_lookupidptr(gmp, co->lg_geom);
+ co->lg_geom = geom_lookup_geom(gmp, co->lg_geom);
if (co->lg_provider != NULL) {
- co->lg_provider = geom_lookupidptr(gmp,
- co->lg_provider);
+ co->lg_provider = geom_lookup_provider(gmp,
+ co->lg_provider);
if (co->lg_provider != NULL) {
LIST_INSERT_HEAD(
&co->lg_provider->lg_consumers,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 4, 6:38 AM (5 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35946018
Default Alt Text
D54454.id168876.diff (2 KB)
Attached To
Mode
D54454: libgeom: Improve type safety of xml2tree code
Attached
Detach File
Event Timeline
Log In to Comment