From ac52bdb19720d0e0be9cf3bd85c8011975d3857f Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 14 Mar 2002 21:09:57 +0000 Subject: 2002-01-19 Roland McGrath * 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 * 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. --- libstore/decode.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'libstore/decode.c') 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 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; } -- cgit v1.2.3