kfogel 2002/08/15 10:56:04
Modified: include apr_errno.h
misc/unix errorcodes.c
Log:
Expand the error code spaces:
* include/apr_errno.h
(APR_OS_ERRSPACE_SIZE): New #defined constant, init to 50000.
(APR_OS_START_USERERR): New name for APR_OS_START_USEERR. Leave the
old name defined for compatibility, but mark as obsolete.
(APR_OS_START_STATUS, APR_OS_START_USERERR, APR_OS_START_CANONERR,
APR_OS_START_EAIERR, APR_OS_START_SYSERR): Expand ranges as per
above, and give USERERR a range ten times larger than the others.
* misc/unix/errorcodes.c
(apr_strerror): Adjust for the rename.
Revision Changes Path
1.95 +22 -7 apr/include/apr_errno.h
Index: apr_errno.h
===================================================================
RCS file: /home/cvs/apr/include/apr_errno.h,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- apr_errno.h 4 Aug 2002 01:35:44 -0000 1.94
+++ apr_errno.h 15 Aug 2002 17:56:04 -0000 1.95
@@ -149,29 +149,44 @@
*/
#define APR_OS_START_ERROR 20000
/**
+ * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit
+ * into one of the error/status ranges below -- except for
+ * APR_OS_START_USERERR, which see.
+ */
+#define APR_OS_ERRSPACE_SIZE 50000
+/**
* APR_OS_START_STATUS is where the APR specific status codes start.
*/
-#define APR_OS_START_STATUS (APR_OS_START_ERROR + 500)
+#define APR_OS_START_STATUS (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
+/**
+ * APR_OS_START_USERERR are reserved for applications that use APR that
+ * layer their own error codes along with APR's. Note that the
+ * error immediately following this one is set ten times farther
+ * away than usual, so that users of apr have a lot of room in
+ * which to declare custom error codes.
+ */
+#define APR_OS_START_USERERR (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE)
/**
- * APR_OS_START_USEERR are reserved for applications that use APR that
- * layer their own error codes along with APR's.
+ * APR_OS_START_USEERR is obsolete, defined for compatibility only.
+ * Use APR_OS_START_USERERR instead.
*/
-#define APR_OS_START_USEERR (APR_OS_START_STATUS + 500)
+#define APR_OS_START_USEERR APR_OS_START_USERERR
/**
* APR_OS_START_CANONERR is where APR versions of errno values are defined
* on systems which don't have the corresponding errno.
*/
-#define APR_OS_START_CANONERR (APR_OS_START_USEERR + 500)
+#define APR_OS_START_CANONERR (APR_OS_START_USERERR \
+ + (APR_OS_ERRSPACE_SIZE * 10))
/**
* APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
* apr_status_t values.
*/
-#define APR_OS_START_EAIERR (APR_OS_START_CANONERR + 500)
+#define APR_OS_START_EAIERR (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE)
/**
* APR_OS_START_SYSERR folds platform-specific system error values into
* apr_status_t values.
*/
-#define APR_OS_START_SYSERR (APR_OS_START_EAIERR + 500)
+#define APR_OS_START_SYSERR (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE)
/** no error. @see APR_STATUS_IS_SUCCESS */
#define APR_SUCCESS 0
1.50 +1 -1 apr/misc/unix/errorcodes.c
Index: errorcodes.c
===================================================================
RCS file: /home/cvs/apr/misc/unix/errorcodes.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- errorcodes.c 4 Apr 2002 16:38:59 -0000 1.49
+++ errorcodes.c 15 Aug 2002 17:56:04 -0000 1.50
@@ -409,7 +409,7 @@
if (statcode < APR_OS_START_ERROR) {
return native_strerror(statcode, buf, bufsize);
}
- else if (statcode < APR_OS_START_USEERR) {
+ else if (statcode < APR_OS_START_USERERR) {
return stuffbuffer(buf, bufsize, apr_error_string(statcode));
}
else if (statcode < APR_OS_START_EAIERR) {