summaryrefslogtreecommitdiff
path: root/src/KM_log.h
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2007-01-19 08:58:05 +0000
committerjhurst <>2007-01-19 08:58:05 +0000
commit984de376d405e0b68e77d61558d4f798fa1170a5 (patch)
tree9767cbae4ad744b88285c8671af60b22c54dfa5d /src/KM_log.h
parentf0476a3789369459fb91076af4a29372d86d7622 (diff)
updated TEST_NULL debug macros
fixed ReadFileIntoString buffer bug
Diffstat (limited to 'src/KM_log.h')
-rwxr-xr-xsrc/KM_log.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/KM_log.h b/src/KM_log.h
index 2bbc330..9838f4c 100755
--- a/src/KM_log.h
+++ b/src/KM_log.h
@@ -41,6 +41,26 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define LOG_MSG_IMPL(t) va_list args; va_start(args, fmt); vLogf((t), fmt, &args); va_end(args)
+
+// Returns RESULT_PTR if the given argument is NULL.
+# define KM_TEST_NULL_L(p) \
+ if ( (p) == 0 ) { \
+ DefaultLogSink().Error("NULL pointer in file %s, line %d\n", __FILE__, __LINE__); \
+ return Kumu::RESULT_PTR; \
+ }
+
+// Returns RESULT_PTR if the given argument is NULL. It then
+// assumes that the argument is a pointer to a string and returns
+// RESULT_NULL_STR if the first character is '\0'.
+//
+# define KM_TEST_NULL_STR_L(p) \
+ KM_TEST_NULL_L(p); \
+ if ( (p)[0] == '\0' ) { \
+ DefaultLogSink().Error("Empty string in file %s, line %d\n", __FILE__, __LINE__); \
+ return Kumu::RESULT_NULL_STR; \
+ }
+
+
namespace Kumu
{
// no log message will exceed this length