title: How can we give arguments to the token-pasting operator parameter specified in the Macro function?
body: <p>I'm trying to use systemd's helper macros, but I don't quite understand the working mechanism. Systemd macros as below;</p>
  <pre><code>#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func)                 \
          static inline void func##p(type *p) {                   \
                  if (*p)                                         \
                          *p = func(*p);                          \
          }
  </code></pre>
  <p>I did not understand how to give the &quot;p&quot; parameter as an argument in the macro I mentioned above. I would like to explain the problem with an example.</p>
  <p>First of all, I created udev enumerate object;</p>
  <pre><code>struct udev_enumerate* enumerate = udev_enumerate_new(pudev);
  </code></pre>
  <p>When I want to delete this object later, how do I do it using the systemd macro?</p>
  <pre><code>DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_enumerate*, udev_enumerate_unref);
  </code></pre>
  <p>Type and function are specified according to the macro, but how is the &quot;p&quot; parameter in the macro (ie the object that I produced) specified in the macro?</p>