fen.cocci 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /// These iterators only exit normally when the loop cursor is NULL, so there
  2. /// is no point to call of_node_put on the final value.
  3. ///
  4. // Confidence: High
  5. // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.
  6. // Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2.
  7. // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2.
  8. // URL: http://coccinelle.lip6.fr/
  9. // Comments:
  10. // Options: -no_includes -include_headers
  11. virtual patch
  12. @@
  13. iterator name for_each_node_by_name;
  14. expression np,E;
  15. identifier l;
  16. @@
  17. for_each_node_by_name(np,...) {
  18. ... when != break;
  19. when != goto l;
  20. }
  21. ... when != np = E
  22. - of_node_put(np);
  23. @@
  24. iterator name for_each_node_by_type;
  25. expression np,E;
  26. identifier l;
  27. @@
  28. for_each_node_by_type(np,...) {
  29. ... when != break;
  30. when != goto l;
  31. }
  32. ... when != np = E
  33. - of_node_put(np);
  34. @@
  35. iterator name for_each_compatible_node;
  36. expression np,E;
  37. identifier l;
  38. @@
  39. for_each_compatible_node(np,...) {
  40. ... when != break;
  41. when != goto l;
  42. }
  43. ... when != np = E
  44. - of_node_put(np);
  45. @@
  46. iterator name for_each_matching_node;
  47. expression np,E;
  48. identifier l;
  49. @@
  50. for_each_matching_node(np,...) {
  51. ... when != break;
  52. when != goto l;
  53. }
  54. ... when != np = E
  55. - of_node_put(np);