bind9/cocci/isc_mem_cget.spatch
Ondřej Surý 60760420aa
Update the semantic patches to use new development ideas
Co-Authored-By: Markus Elfring <Markus.Elfring@web.de>
2025-10-08 17:22:10 +02:00

136 lines
2.3 KiB
Text

@replacement1@
expression MCTX, COUNT, ELEM;
type T;
@@
-isc_mem_get
+isc_mem_cget
(MCTX,
(
- COUNT * sizeof(ELEM)
+ COUNT, sizeof(ELEM)
|
- COUNT * sizeof(T)
+ COUNT, sizeof(T)
)
)
@replacement2@
expression MCTX, OLD_PTR, COUNT, ELEM;
type T;
@@
-isc_mem_put
+isc_mem_cput
(MCTX,
OLD_PTR,
(
- COUNT * sizeof(ELEM)
+ COUNT, sizeof(ELEM)
|
- COUNT * sizeof(T)
+ COUNT, sizeof(T)
)
)
@replacement3@
expression MCTX, OLD_PTR, NEW_PTR, OLD_COUNT, NEW_COUNT, ELEM;
identifier OLD_SIZE, NEW_SIZE;
type T;
@@
(
(
-size_t OLD_SIZE = OLD_COUNT * sizeof(ELEM);
-size_t NEW_SIZE = NEW_COUNT * sizeof(ELEM);
|
-size_t NEW_SIZE = NEW_COUNT * sizeof(ELEM);
-size_t OLD_SIZE = OLD_COUNT * sizeof(ELEM);
)
NEW_PTR =
- isc_mem_reget
+ isc_mem_creget
(MCTX, OLD_PTR, OLD_SIZE, NEW_SIZE
+ , sizeof(ELEM)
);
|
(
-size_t OLD_SIZE = OLD_COUNT * sizeof(T);
-size_t NEW_SIZE = NEW_COUNT * sizeof(T);
|
-size_t NEW_SIZE = NEW_COUNT * sizeof(T);
-size_t OLD_SIZE = OLD_COUNT * sizeof(T);
)
NEW_PTR =
- isc_mem_reget
+ isc_mem_creget
(MCTX, OLD_PTR, OLD_SIZE, NEW_SIZE
+ , sizeof(T)
);
)
@replacement4@
expression MCTX, OLD_PTR, NEW_PTR, OLD_SIZE, OLD_COUNT, NEW_SIZE, NEW_COUNT, ELEM;
type T;
@@
(
(
-OLD_SIZE = OLD_COUNT * sizeof(ELEM);
-NEW_SIZE = NEW_COUNT * sizeof(ELEM);
|
-NEW_SIZE = NEW_COUNT * sizeof(ELEM);
-OLD_SIZE = OLD_COUNT * sizeof(ELEM);
)
NEW_PTR =
- isc_mem_reget
+ isc_mem_creget
(MCTX, OLD_PTR, OLD_SIZE, NEW_SIZE
+ , sizeof(ELEM)
);
|
(
-OLD_SIZE = OLD_COUNT * sizeof(T);
-NEW_SIZE = NEW_COUNT * sizeof(T);
|
-NEW_SIZE = NEW_COUNT * sizeof(T);
-OLD_SIZE = OLD_COUNT * sizeof(T);
)
NEW_PTR =
- isc_mem_reget
+ isc_mem_creget
(MCTX, OLD_PTR, OLD_SIZE, NEW_SIZE
+ , sizeof(T)
);
)
@replacement5@
expression MCTX, OLD_PTR, OLD_COUNT, NEW_COUNT, ELEM;
type T;
@@
-isc_mem_reget
+isc_mem_creget
(MCTX,
OLD_PTR,
(
- OLD_COUNT * sizeof(ELEM)
+ OLD_COUNT
,
- NEW_COUNT * sizeof(ELEM)
+ NEW_COUNT, sizeof(ELEM)
|
- OLD_COUNT * sizeof(T)
+ OLD_COUNT
,
- NEW_COUNT * sizeof(T)
+ NEW_COUNT, sizeof(T)
)
)
@replacement6@
expression MCTX, OLD_PTR, OLD_SIZE, NEW_SIZE;
@@
-isc_mem_reget
+isc_mem_creget
(MCTX,
OLD_PTR,
OLD_SIZE,
NEW_SIZE
+ , sizeof(char)
)