mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-15 01:53:41 +08:00
Add Coccinelle rule to use NameStr
Direct access of the `.data` member of `NameData` structures are discuraged and `NameStr` should be used instead. Also adding one instance that was missed in #5336.
This commit is contained in:
parent
36c36564a8
commit
4e17247e76
@ -22,3 +22,26 @@ symbol NAMEDATALEN;
|
||||
- strlcpy(E1, E2, NAMEDATALEN);
|
||||
+ /* You are using strlcpy with NAMEDATALEN, please consider using NameData and namestrcpy instead. */
|
||||
+ namestrcpy(E1, E2);
|
||||
|
||||
@@
|
||||
typedef NameData;
|
||||
NameData E;
|
||||
@@
|
||||
- E.data
|
||||
+ /* Use NameStr rather than accessing data member directly */
|
||||
+ NameStr(E)
|
||||
|
||||
@@
|
||||
NameData *E;
|
||||
@@
|
||||
- E->data
|
||||
+ /* Use NameStr rather than accessing data member directly */
|
||||
+ NameStr(*E)
|
||||
|
||||
@@
|
||||
typedef Name;
|
||||
Name E;
|
||||
@@
|
||||
- E->data
|
||||
+ /* Use NameStr rather than accessing data member directly */
|
||||
+ NameStr(*E)
|
||||
|
@ -151,7 +151,7 @@ column_is_serial(Relation rel, Name column)
|
||||
NameStr(rel->rd_rel->relname));
|
||||
InitFunctionCallInfoData(*fcinfo, NULL, 2, InvalidOid, NULL, NULL);
|
||||
FC_ARG(fcinfo, 0) = CStringGetTextDatum(relation_name);
|
||||
FC_ARG(fcinfo, 1) = CStringGetTextDatum(column->data);
|
||||
FC_ARG(fcinfo, 1) = CStringGetTextDatum(NameStr(*column));
|
||||
FC_NULL(fcinfo, 0) = false;
|
||||
FC_NULL(fcinfo, 1) = false;
|
||||
pg_get_serial_sequence(fcinfo);
|
||||
|
Loading…
x
Reference in New Issue
Block a user