summaryrefslogtreecommitdiff
path: root/libstore
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-03-14 21:09:57 +0000
committerRoland McGrath <roland@gnu.org>2002-03-14 21:09:57 +0000
commitac52bdb19720d0e0be9cf3bd85c8011975d3857f (patch)
tree10601347db737923d89141357ed83c711c5bf345 /libstore
parentd99574dbe8c7f0591c29d86bc63a624a4da7db62 (diff)
2002-01-19 Roland McGrath <roland@frob.com>
* url.c (url_decode): Renamed to store_url_decode, made public. (store_url_open_class): Changed use. * store.h: Declare store_url_decode. * decode.c (store_decode): Call store_url_decode for STORAGE_NETWORK as a special case. 2001-12-28 Roland McGrath <roland@frob.com> * module.c: New file. * store.h (store_module_open, store_module_find_class, store_module_decode): Declare them. * argp.c (parse_opt): Leave PARSED->classes null here instead of defaulting to store_std_classes. (find_class): Default null class-list parameter to store_std_classes here instead. If no matches when defaulted, try calling store_module_open_class too. * typed.c (store_typed_open): If no match when search list is store_std_classes, try calling store_module_open_class too. * url.c (find_url_class): Likewise. * decode.c (store_decode): If no match when search list is store_std_classes, try calling store_module_decode too.
Diffstat (limited to 'libstore')
-rw-r--r--libstore/decode.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/libstore/decode.c b/libstore/decode.c
index cae2ba2f..64405ecd 100644
--- a/libstore/decode.c
+++ b/libstore/decode.c
@@ -1,6 +1,6 @@
/* Store wire decoding
- Copyright (C) 1996,97,98,2001 Free Software Foundation, Inc.
+ Copyright (C) 1996,97,98,2001,02 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
This file is part of the GNU Hurd.
@@ -174,10 +174,15 @@ store_decode (struct store_enc *enc, const struct store_class *const *classes,
/* The first int should always be the type. */
return EINVAL;
- if (! classes)
- classes = store_std_classes;
+ if (enc->ints[enc->cur_int] == STORAGE_NETWORK)
+ /* This is a special case because store classes supporting
+ individual URL types will also use STORAGE_NETWORK,
+ and we want the generic dispatcher to come first. */
+ return store_url_decode (enc, classes, store);
- for (cl = classes; *classes; cl ++)
+ for (cl = classes ?: __start_store_std_classes;
+ classes ? *cl != 0 : cl < __stop_store_std_classes;
+ ++cl)
if ((*cl)->id == enc->ints[enc->cur_int])
{
if ((*cl)->decode)
@@ -186,5 +191,13 @@ store_decode (struct store_enc *enc, const struct store_class *const *classes,
return EOPNOTSUPP;
}
+# pragma weak store_module_decode
+ if (! classes && store_module_decode)
+ {
+ error_t err = store_module_decode (enc, classes, store);
+ if (err != ENOENT)
+ return err;
+ }
+
return EINVAL;
}