diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-06 06:07:33 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-06 06:07:33 +0000 |
commit | 06b2035cc7444370e4ad913f25e400545915a743 (patch) | |
tree | 4f0eea47f7ec42ad43d4b3fad7f7d5907e416115 /misc | |
parent | 6105382e1c48011d628cd0562e87471ca605e8cb (diff) | |
download | libapr-06b2035cc7444370e4ad913f25e400545915a743.tar.gz |
Remaining cleanup of ap_ -> apr_ and AP_ -> APR_ transformation...
see src/lib/apr/apr_compat.h for most details.
Also a few minor nits to get Win32 to build.
PR:
Obtained from:
Submitted by:
Reviewed by:
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60481 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc')
-rw-r--r-- | misc/unix/errorcodes.c | 4 | ||||
-rw-r--r-- | misc/unix/getopt.c | 64 | ||||
-rw-r--r-- | misc/unix/misc.h | 37 | ||||
-rw-r--r-- | misc/win32/misc.c | 4 | ||||
-rw-r--r-- | misc/win32/names.c | 6 |
5 files changed, 58 insertions, 57 deletions
diff --git a/misc/unix/errorcodes.c b/misc/unix/errorcodes.c index 697ea0a40..9699cb5c8 100644 --- a/misc/unix/errorcodes.c +++ b/misc/unix/errorcodes.c @@ -187,9 +187,9 @@ static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) for (c=0; c<len; c++) { /* skip multiple whitespace */ - while (ap_isspace(message[c]) && ap_isspace(message[c+1])) + while (apr_isspace(message[c]) && apr_isspace(message[c+1])) c++; - *(pos++) = ap_isspace(message[c]) ? ' ' : message[c]; + *(pos++) = apr_isspace(message[c]) ? ' ' : message[c]; } *pos = 0; diff --git a/misc/unix/getopt.c b/misc/unix/getopt.c index bdee3afbd..b28b9e677 100644 --- a/misc/unix/getopt.c +++ b/misc/unix/getopt.c @@ -34,91 +34,91 @@ #include "misc.h" APR_VAR_EXPORT int - ap_opterr = 1, /* if error message should be printed */ - ap_optind = 1, /* index into parent argv vector */ - ap_optopt, /* character checked for validity */ - ap_optreset; /* reset getopt */ -APR_VAR_EXPORT char *ap_optarg = ""; /* argument associated with option */ + apr_opterr = 1, /* if error message should be printed */ + apr_optind = 1, /* index into parent argv vector */ + apr_optopt, /* character checked for validity */ + apr_optreset; /* reset getopt */ +APR_VAR_EXPORT char *apr_optarg = ""; /* argument associated with option */ #define EMSG "" APR_EXPORT(apr_status_t) apr_getopt(apr_int32_t nargc, char *const *nargv, - const char *ostr, apr_int32_t *rv, - apr_pool_t *cont) + const char *ostr, apr_int32_t *rv, + apr_pool_t *cont) { char *p; static char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ - if (ap_optreset || !*place) { /* update scanning pointer */ - ap_optreset = 0; - if (ap_optind >= nargc || *(place = nargv[ap_optind]) != '-') { + if (apr_optreset || !*place) { /* update scanning pointer */ + apr_optreset = 0; + if (apr_optind >= nargc || *(place = nargv[apr_optind]) != '-') { place = EMSG; - *rv = ap_optopt; + *rv = apr_optopt; return (APR_EOF); } if (place[1] && *++place == '-') { /* found "--" */ - ++ap_optind; + ++apr_optind; place = EMSG; - *rv = ap_optopt; + *rv = apr_optopt; return (APR_EOF); } } /* option letter okay? */ - if ((ap_optopt = (int) *place++) == (int) ':' || - !(oli = strchr(ostr, ap_optopt))) { + if ((apr_optopt = (int) *place++) == (int) ':' || + !(oli = strchr(ostr, apr_optopt))) { /* * if the user didn't specify '-' as an option, * assume it means -1. */ - if (ap_optopt == (int) '-') { - *rv = ap_optopt; + if (apr_optopt == (int) '-') { + *rv = apr_optopt; return (APR_EOF); } if (!*place) - ++ap_optind; - if (ap_opterr && *ostr != ':') { + ++apr_optind; + if (apr_opterr && *ostr != ':') { if (!(p = strrchr(*nargv, '/'))) p = *nargv; else ++p; (void) fprintf(stderr, - "%s: illegal option -- %c\n", p, ap_optopt); + "%s: illegal option -- %c\n", p, apr_optopt); } - *rv = ap_optopt; + *rv = apr_optopt; return APR_BADCH; } if (*++oli != ':') { /* don't need argument */ - ap_optarg = NULL; + apr_optarg = NULL; if (!*place) - ++ap_optind; + ++apr_optind; } else { /* need an argument */ if (*place) /* no white space */ - ap_optarg = place; - else if (nargc <= ++ap_optind) { /* no arg */ + apr_optarg = place; + else if (nargc <= ++apr_optind) { /* no arg */ place = EMSG; if (*ostr == ':') { - *rv = ap_optopt; + *rv = apr_optopt; return (APR_BADARG); } - if (ap_opterr) { + if (apr_opterr) { if (!(p = strrchr(*nargv, '/'))) p = *nargv; else ++p; (void) fprintf(stderr, "%s: option requires an argument -- %c\n", - p, ap_optopt); + p, apr_optopt); } - *rv = ap_optopt; + *rv = apr_optopt; return (APR_BADCH); } else /* white space */ - ap_optarg = nargv[ap_optind]; + apr_optarg = nargv[apr_optind]; place = EMSG; - ++ap_optind; + ++apr_optind; } - *rv = ap_optopt; + *rv = apr_optopt; return APR_SUCCESS; } diff --git a/misc/unix/misc.h b/misc/unix/misc.h index f02c112dc..e0ce1d050 100644 --- a/misc/unix/misc.h +++ b/misc/unix/misc.h @@ -115,7 +115,7 @@ typedef enum { APR_WIN_NT_4_SP4 = 16, APR_WIN_NT_4_SP6 = 18, APR_WIN_2000 = 24 -} ap_oslevel_e; +} apr_oslevel_e; typedef enum { @@ -124,25 +124,26 @@ typedef enum { DLL_WINSOCKAPI = 2, // mswsock From WinSock.h DLL_WINSOCK2API = 3, // ws2_32 From WinSock2.h DLL_defined = 4 // must define as last idx_ + 1 -} ap_dlltoken_e; +} apr_dlltoken_e; -FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char *fnName, int ordinal); +FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal); -/* The ap_load_dll_func call WILL fault if the function cannot be loaded */ +/* The apr_load_dll_func call WILL fault if the function cannot be loaded */ -#define AP_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \ - typedef rettype (calltype *ap_winapi_fpt_##fn) args; \ - static ap_winapi_fpt_##fn ap_winapi_pfn_##fn = NULL; \ - __inline rettype ap_winapi_##fn args \ - { if (!ap_winapi_pfn_##fn) \ - ap_winapi_pfn_##fn = (ap_winapi_fpt_##fn) ap_load_dll_func(lib, #fn, ord); \ - return (*(ap_winapi_pfn_##fn)) names; }; \ +#define APR_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \ + typedef rettype (calltype *apr_winapi_fpt_##fn) args; \ + static apr_winapi_fpt_##fn apr_winapi_pfn_##fn = NULL; \ + __inline rettype apr_winapi_##fn args \ + { if (!apr_winapi_pfn_##fn) \ + apr_winapi_pfn_##fn = (apr_winapi_fpt_##fn) \ + apr_load_dll_func(lib, #fn, ord); \ + return (*(apr_winapi_pfn_##fn)) names; }; \ /* Provide late bound declarations of every API function missing from * one or more supported releases of the Win32 API * - * lib is the enumerated token from ap_dlltoken_e, and must correspond - * to the string table entry in start.c used by the ap_load_dll_func(). + * lib is the enumerated token from apr_dlltoken_e, and must correspond + * to the string table entry in start.c used by the apr_load_dll_func(). * Token names (attempt to) follow Windows.h declarations prefixed by DLL_ * in order to facilitate comparison. Use the exact declaration syntax * and names from Windows.h to prevent ambigutity and bugs. @@ -157,20 +158,20 @@ FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char *fnName, int ordinal); * In the case of non-text functions, simply #define the original name */ -AP_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, GetFileAttributesExA, 0, ( +APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, GetFileAttributesExA, 0, ( IN LPCSTR lpFileName, IN GET_FILEEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFileInformation), (lpFileName, fInfoLevelId, lpFileInformation)); #undef GetFileAttributesEx -#define GetFileAttributesEx ap_winapi_GetFileAttributesExA +#define GetFileAttributesEx apr_winapi_GetFileAttributesExA -AP_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, CancelIo, 0, ( +APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, CancelIo, 0, ( IN HANDLE hFile), (hFile)); -#define CancelIo ap_winapi_CancelIo +#define CancelIo apr_winapi_CancelIo -apr_status_t ap_get_oslevel(struct apr_pool_t *, ap_oslevel_e *); +apr_status_t apr_get_oslevel(struct apr_pool_t *, apr_oslevel_e *); #endif /* WIN32 */ #endif /* ! MISC_H */ diff --git a/misc/win32/misc.c b/misc/win32/misc.c index 734c5a018..f4b00b074 100644 --- a/misc/win32/misc.c +++ b/misc/win32/misc.c @@ -55,7 +55,7 @@ #include "apr_private.h" #include "misc.h" -apr_status_t ap_get_oslevel(apr_pool_t *cont, ap_oslevel_e *level) +apr_status_t apr_get_oslevel(apr_pool_t *cont, apr_oslevel_e *level) { static OSVERSIONINFO oslev; static unsigned int servpack = 0; @@ -123,7 +123,7 @@ static const char* const lateDllName[DLL_defined] = { static HMODULE lateDllHandle[DLL_defined] = { NULL, NULL, NULL, NULL }; -FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char* fnName, int ordinal) +FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char* fnName, int ordinal) { if (!lateDllHandle[fnLib]) { lateDllHandle[fnLib] = LoadLibrary(lateDllName[fnLib]); diff --git a/misc/win32/names.c b/misc/win32/names.c index 81587cf9c..baa20236a 100644 --- a/misc/win32/names.c +++ b/misc/win32/names.c @@ -82,7 +82,7 @@ static BOOL OnlyDots(char *pString) * is present on the existing path. This routine also * converts alias names to long names. */ -APR_EXPORT(char *) ap_os_systemcase_filename(apr_pool_t *pCont, +APR_EXPORT(char *) apr_os_systemcase_filename(apr_pool_t *pCont, const char *szFile) { char buf[HUGE_STRING_LEN]; @@ -271,10 +271,10 @@ char * canonical_filename(apr_pool_t *pCont, const char *szFile) char *pConvertedName, *pQstr, *pPstr; char buf[HUGE_STRING_LEN]; /* We potentially have a short name. Call - * ap_os_systemcase_filename to examine the filesystem + * apr_os_systemcase_filename to examine the filesystem * and possibly extract the long name. */ - pConvertedName = ap_os_systemcase_filename(pCont, pNewStr); + pConvertedName = apr_os_systemcase_filename(pCont, pNewStr); /* Since we want to preserve the incoming case as much * as we can, compare for differences in the string and |