The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/tools/cocci/zalloc-zero.cocci

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 // To apply, at the top of xnu.git:
    2 // $ spatch --max-width=80 --use-gitgrep --in-place --include-headers --sp-file tools/cocci/zalloc.cocci -dir .
    3 //
    4 // This might need to be run several times
    5 
    6 @ using "zalloc.iso" @
    7 expression E, F, G;
    8 type T;
    9 identifier V;
   10 @@
   11 (
   12 
   13 (
   14   E = zalloc_flags(F, \(Z_ZERO\|Z_ZERO | ...\));
   15 |
   16   E = kalloc_type(F, \(Z_ZERO\|Z_ZERO | ...\));
   17 |
   18   E = \(kalloc_data\|kalloc_flags\)(F, \(Z_ZERO\|Z_ZERO | ...\));
   19 |
   20 - E = zalloc(F);
   21 + E = zalloc_flags(F, Z_WAITOK | Z_ZERO);
   22 |
   23   E = zalloc_flags(F, \(Z_WAITOK\| Z_WAITOK | ...\)
   24 + | Z_ZERO
   25   );
   26 )
   27   ...
   28 - bzero(E, G);
   29 
   30 |
   31 
   32 (
   33 - E = kalloc(F);
   34 + E = kalloc_flags(F, Z_WAITOK | Z_ZERO);
   35 |
   36   E = kalloc_type(T, \(Z_WAITOK\| Z_WAITOK | ...\)
   37 + | Z_ZERO
   38   );
   39 |
   40   E = \(kalloc_data\|kalloc_flags\)(F, \(Z_WAITOK\| Z_WAITOK | ...\)
   41 + | Z_ZERO
   42   );
   43 )
   44   ...
   45 - bzero(E, F);
   46 
   47 |
   48 
   49 
   50 - T V = zalloc(F);
   51 + T V = zalloc_flags(F, Z_WAITOK | Z_ZERO);
   52   ...
   53 - bzero(V, G);
   54 
   55 |
   56 
   57 (
   58   T V = zalloc_flags(F, \(Z_ZERO\|Z_ZERO | ...\));
   59 |
   60   T V = kalloc_type(T, \(Z_ZERO\|Z_ZERO | ...\));
   61 |
   62   T V = \(kalloc_data\|kalloc_flags\)(F, \(Z_ZERO\|Z_ZERO | ...\));
   63 |
   64 - T V = kalloc(F);
   65 + T V = kalloc_flags(F, Z_WAITOK | Z_ZERO);
   66 |
   67   T V = kalloc_type(T, \(Z_WAITOK\| Z_WAITOK | ...\)
   68 + | Z_ZERO
   69   );
   70 |
   71   T V = \(zalloc_flags\|kalloc_data\|kalloc_flags\)(F, \(Z_WAITOK\| Z_WAITOK | ...\)
   72 + | Z_ZERO
   73   );
   74 )
   75   ...
   76 - bzero(V, F);
   77 
   78 )
   79 
   80 // vim:ft=diff:

Cache object: 64e538ccd735816337d7dba8f266e3c1


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.