summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-03-18 12:26:55 +0000
committerBenny Prijono <bennylp@teluu.com>2006-03-18 12:26:55 +0000
commit1ef58d201f4613f91a9cbafa4545f37f3fab3cf6 (patch)
tree7169f9c55ab05f6140bc6f2faa0d583166b1eb94 /pjlib
parentf8793f52a83dd232eddf2bb61f48cca6dd759ffd (diff)
Added option to disable error message altogether, to save space footprint
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@330 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/src/pj/errno.c11
-rw-r--r--pjlib/src/pj/os_error_win32.c8
2 files changed, 14 insertions, 5 deletions
diff --git a/pjlib/src/pj/errno.c b/pjlib/src/pj/errno.c
index 9843105c..086bfcd7 100644
--- a/pjlib/src/pj/errno.c
+++ b/pjlib/src/pj/errno.c
@@ -39,6 +39,7 @@ static struct err_msg_hnd
} err_msg_hnd[PJLIB_MAX_ERR_MSG_HANDLER];
/* PJLIB's own error codes/messages */
+#if defined(PJ_HAS_ERROR_STRING) && PJ_HAS_ERROR_STRING!=0
static const struct
{
int code;
@@ -62,6 +63,8 @@ static const struct
{ PJ_EEXISTS, "Object already exists" },
{ PJ_EEOF, "End of file" },
};
+#endif /* PJ_HAS_ERROR_STRING */
+
/*
* pjlib_error()
@@ -70,6 +73,7 @@ static const struct
*/
static int pjlib_error(pj_status_t code, char *buf, pj_size_t size)
{
+#if defined(PJ_HAS_ERROR_STRING) && PJ_HAS_ERROR_STRING!=0
unsigned i;
for (i=0; i<sizeof(err_str)/sizeof(err_str[0]); ++i) {
@@ -81,12 +85,9 @@ static int pjlib_error(pj_status_t code, char *buf, pj_size_t size)
return len;
}
}
+#endif
- *buf++ = '?';
- *buf++ = '?';
- *buf++ = '?';
- *buf++ = '\0';
- return 3;
+ return pj_ansi_snprintf( buf, size, "Unknown pjlib error %d", code);
}
#define IN_RANGE(val,start,end) ((val)>=(start) && (val)<(end))
diff --git a/pjlib/src/pj/os_error_win32.c b/pjlib/src/pj/os_error_win32.c
index 8c6d56c3..80a4eb23 100644
--- a/pjlib/src/pj/os_error_win32.c
+++ b/pjlib/src/pj/os_error_win32.c
@@ -33,6 +33,8 @@
/*
* From Apache's APR:
*/
+#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING!=0)
+
static const struct {
pj_os_err_type code;
const char *msg;
@@ -89,6 +91,9 @@ static const struct {
{0, NULL}
};
+#endif /* PJ_HAS_ERROR_STRING */
+
+
PJ_DEF(pj_status_t) pj_get_os_error(void)
{
@@ -155,6 +160,8 @@ int platform_strerror( pj_os_err_type os_errcode,
#endif
if (!len) {
+
+#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING!=0)
int i;
for (i = 0; gaErrorList[i].msg; ++i) {
if (gaErrorList[i].code == os_errcode) {
@@ -167,6 +174,7 @@ int platform_strerror( pj_os_err_type os_errcode,
break;
}
}
+#endif /* PJ_HAS_ERROR_STRING */
} else {
/* Remove trailing newlines. */