From 66b708b112244bb6e11449ef5545ebe7194c73ba Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 26 Oct 2009 23:05:49 +0000 Subject: [PATCH] Minor changes to the {,_}sqlcall macro. --- sqlite3.h | 14 ++++++-------- stdlib.h | 6 +++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/sqlite3.h b/sqlite3.h index b721343..50c3bd5 100644 --- a/sqlite3.h +++ b/sqlite3.h @@ -41,14 +41,12 @@ #include #include -#define sqlcall(expr) \ - do { \ - int _value = (expr); \ - if (_value == 0 || (_value >= 100 && _value < 200)) \ - break; \ - fprintf(stderr, "%s(%u): sqlcall(%u:%s): %s\n", __FILE__, __LINE__, _value, #expr, sqlite3_errmsg(database_)); \ - exit(1); \ - } while (false) +#define _sqlcall(expr) ({ \ + __typeof__(expr) _value = (expr); \ + if (_value != 0 && (_value < 100 || _value >= 200)) \ + _assert(false, "_sqlcall(%u:%s): %s\n", _value, #expr, sqlite3_errmsg(database_)); \ + _value; \ +}) int sqlite3_bind_string(sqlite3_stmt *stmt, int n, const char *value) { if (value == NULL) diff --git a/stdlib.h b/stdlib.h index 1129f79..021ae70 100644 --- a/stdlib.h +++ b/stdlib.h @@ -65,8 +65,8 @@ } while (false) #define _syscall(expr) ({ \ - __typeof__(expr) value; \ - do if ((long) (value = (expr)) != -1) \ + __typeof__(expr) _value; \ + do if ((long) (_value = (expr)) != -1) \ break; \ else switch (errno) { \ case EINTR: \ @@ -74,7 +74,7 @@ default: \ _assert(false); \ } while (true); \ - value; \ + _value; \ }) #define _aprcall(expr) \ -- 2.45.2