Welcome to mirror list, hosted at ThFree Co, Russian Federation.

config_fn_ctx.pending.cocci « coccinelle « contrib - git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6d3d1000a9657d5ec6b685cc0017269985892bfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
@ get_fn @
identifier fn, R;
@@
(
(
git_config_from_file
|
git_config_from_file_with_options
|
git_config_from_mem
|
git_config_from_blob_oid
|
read_early_config
|
read_very_early_config
|
config_with_options
|
git_config
|
git_protected_config
|
config_from_gitmodules
)
  (fn, ...)
|
repo_config(R, fn, ...)
)

@ extends get_fn @
identifier C1, C2, D;
@@
int fn(const char *C1, const char *C2,
+ const struct config_context *ctx,
  void *D);

@ extends get_fn @
@@
int fn(const char *, const char *,
+ const struct config_context *,
  void *);

@ extends get_fn @
// Don't change fns that look like callback fns but aren't
identifier fn2 != tar_filter_config && != git_diff_heuristic_config &&
  != git_default_submodule_config && != git_color_config &&
  != bundle_list_update && != parse_object_filter_config;
identifier C1, C2, D1, D2, S;
attribute name UNUSED;
@@
int fn(const char *C1, const char *C2,
+ const struct config_context *ctx,
  void *D1) {
<+...
(
fn2(C1, C2
+ , ctx
, D2);
|
if(fn2(C1, C2
+ , ctx
, D2) < 0) { ... }
|
return fn2(C1, C2
+ , ctx
, D2);
|
S = fn2(C1, C2
+ , ctx
, D2);
)
...+>
  }

@ extends get_fn@
identifier C1, C2, D;
attribute name UNUSED;
@@
int fn(const char *C1, const char *C2,
+ const struct config_context *ctx UNUSED,
  void *D) {...}


// The previous rules don't catch all callbacks, especially if they're defined
// in a separate file from the git_config() call. Fix these manually.
@@
identifier C1, C2, D;
attribute name UNUSED;
@@
int
(
git_ident_config
|
urlmatch_collect_fn
|
write_one_config
|
forbid_remote_url
|
credential_config_callback
)
  (const char *C1, const char *C2,
+ const struct config_context *ctx UNUSED,
  void *D) {...}

@@
identifier C1, C2, D, D2, S, fn2;
@@
int
(
http_options
|
git_status_config
|
git_commit_config
|
git_default_core_config
|
grep_config
)
  (const char *C1, const char *C2,
+ const struct config_context *ctx,
  void *D) {
<+...
(
fn2(C1, C2
+ , ctx
, D2);
|
if(fn2(C1, C2
+ , ctx
, D2) < 0) { ... }
|
return fn2(C1, C2
+ , ctx
, D2);
|
S = fn2(C1, C2
+ , ctx
, D2);
)
...+>
  }