2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 01:59:26 +00:00
bind/cocci/isc_time_now.spatch
Ondřej Surý a5f5f68502
Refactor isc_time_now() to return time, and not result
The isc_time_now() and isc_time_now_hires() were used inconsistently
through the code - either with status check, or without status check,
or via TIME_NOW() macro with RUNTIME_CHECK() on failure.

Refactor the isc_time_now() and isc_time_now_hires() to always fail when
getting current time has failed, and return the isc_time_t value as
return value instead of passing the pointer to result in the argument.
2023-03-31 15:02:06 +02:00

76 lines
892 B
Plaintext

@@
statement S;
expression V, E;
@@
- V = isc_time_now(&E);
- if (V != ISC_R_SUCCESS) S
+ E = isc_time_now();
@@
expression V, E;
@@
- V = isc_time_now(&E);
- RUNTIME_CHECK(V == ISC_R_SUCCESS);
+ E = isc_time_now();
@@
expression V, E;
@@
- V = isc_time_now(&E);
- assert_int_equal(V, ISC_R_SUCCESS);
+ E = isc_time_now();
@@
expression E;
@@
- assert_int_equal(isc_time_now(&E), ISC_R_SUCCESS);
+ E = isc_time_now();
@@
expression E;
@@
- TIME_NOW(&E);
+ E = isc_time_now();
@@
expression E;
@@
- CHECK(isc_time_now(&E));
+ E = isc_time_now();
@@
statement S;
expression V, E;
@@
- V = isc_time_now_hires(&E);
- if (V != ISC_R_SUCCESS) S
+ E = isc_time_now_hires();
@@
expression E;
@@
- isc_time_now(&E);
+ E = isc_time_now();
@@
expression E;
@@
- isc_time_now_hires(&E);
+ E = isc_time_now_hires();
@@
expression E;
@@
- TIME_NOW_HIRES(&E);
+ E = isc_time_now_hires();