bind9/cocci/isc_mem_zero.spatch
Ondřej Surý c1d26b53eb
Add and use semantic patch to replace isc_mem_get/allocate+memset
Add new semantic patch to replace the straightfoward uses of:

  ptr = isc_mem_{get,allocate}(..., size);
  memset(ptr, 0, size);

with the new API call:

  ptr = isc_mem_{get,allocate}x(..., size, ISC_MEM_ZERO);
2022-10-05 16:44:05 +02:00

17 lines
293 B
Text

@@
expression ptr, ctx, size;
@@
- ptr = isc_mem_get(ctx, size);
+ ptr = isc_mem_getx(ctx, size, ISC_MEM_ZERO);
...
- memset(ptr, 0, size);
@@
expression ptr, ctx, size;
@@
- ptr = isc_mem_allocate(ctx, size);
+ ptr = isc_mem_allocatex(ctx, size, ISC_MEM_ZERO);
...
- memset(ptr, 0, size);