Re: [Maria-developers] 87953156c76: Vanilla cleanup: DBUG_EVALUATE_IF() macro replaced by shorter form DBUG_IF()
Hi, Aleksey! On Sep 01, Aleksey Midenkov wrote:
revision-id: 87953156c76 (mariadb-10.6.1-61-g87953156c76) parent(s): b67fe0c009d author: Aleksey Midenkov committer: Aleksey Midenkov timestamp: 2021-08-30 21:24:35 +0300 message:
Vanilla cleanup: DBUG_EVALUATE_IF() macro replaced by shorter form DBUG_IF()
Thanks, I agree, this looks much better
diff --git a/dbug/user.r b/dbug/user.r index 8d8a9ce6910..3740a60851c 100644 --- a/dbug/user.r +++ b/dbug/user.r @@ -785,18 +785,20 @@ EX:\fC +.B 0 +Like DBUG_EXECUTE_IF this could be used to conditionally execute "dangerous" actions. .SP 1 EX:\fC .br if (prepare_transaction () || .br - DBUG_EVALUATE ("crashme", (DBUG_ABORT(), 0), 0) || + (DBUG_IF("crashme") && (DBUG_ABORT(), 0)) ||
oh, a bug in the manual! good catch.
.br commit_transaction () )\fR .SP 1 diff --git a/include/my_dbug.h b/include/my_dbug.h index e25bfcf28a7..2afcb010e7c 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -102,8 +102,7 @@ extern int (*dbug_sanity)(void); do {if (_db_keyword_(0, (keyword), 1)) { a1 }} while(0) #define DBUG_EVALUATE(keyword,a1,a2) \ (_db_keyword_(0,(keyword), 0) ? (a1) : (a2))
you've kept DBUG_EVALUATE, although it was only added for consistency together with DBUG_EVALUATE_IF. And DBUG_EVALUATE is not used anywhere, I've just grepped. Remove it too?
-#define DBUG_EVALUATE_IF(keyword,a1,a2) \ - (_db_keyword_(0,(keyword), 1) ? (a1) : (a2)) +#define DBUG_IF(keyword) _db_keyword_(0, (keyword), 1) #define DBUG_PRINT(keyword,arglist) \ do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0)
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
participants (1)
-
Sergei Golubchik