2 /// Use resource_size function on resource object
3 /// instead of explicit computation.
6 // Copyright: (C) 2009, 2010 Nicolas Palix, DIKU. GPLv2.
7 // Copyright: (C) 2009, 2010 Julia Lawall, DIKU. GPLv2.
8 // Copyright: (C) 2009, 2010 Gilles Muller, INRIA/LiP6. GPLv2.
9 // URL: http://coccinelle.lip6.fr/
12 // Keywords: resource_size
13 // Version min: 2.6.27 resource_size
21 //----------------------------------------------------------
23 //----------------------------------------------------------
25 @r_context depends on context && !patch && !org@
29 * (res->end - res->start) + 1
31 //----------------------------------------------------------
33 //----------------------------------------------------------
35 @r_patch depends on !context && patch && !org@
39 - (res->end - res->start) + 1
42 //----------------------------------------------------------
44 //----------------------------------------------------------
47 @r_org depends on !context && !patch && (org || report)@
52 (res->end@p - res->start) + 1
54 @rbad_org depends on !context && !patch && (org || report)@
56 position p != r_org.p;
59 res->end@p - res->start
61 @script:python depends on org@
66 msg="ERROR with %s" % (x)
67 msg_safe=msg.replace("[","@(").replace("]",")")
68 coccilib.org.print_todo(p[0], msg_safe)
70 @script:python depends on report@
75 msg="ERROR: Missing resource_size with %s" % (x)
76 coccilib.report.print_report(p[0], msg)
78 @script:python depends on org@
83 msg="WARNING with %s" % (x)
84 msg_safe=msg.replace("[","@(").replace("]",")")
85 coccilib.org.print_todo(p[0], msg_safe)
87 @script:python depends on report@
92 msg="WARNING: Suspicious code. resource_size is maybe missing with %s" % (x)
93 coccilib.report.print_report(p[0], msg)