3 * Common functionality for targets
5 * (c) 2018 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of the `fwd' port forwarder.
12 * `fwd' is free software: you can redistribute it and/or modify it under
13 * the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
17 * `fwd' is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * You should have received a copy of the GNU General Public License
23 * along with `fwd'. If not, write to the Free Software Foundation,
24 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 /*----- Header files ------------------------------------------------------*/
31 /*----- Main code ---------------------------------------------------------*/
33 /* --- @target_inc@ --- *
35 * Arguments: @target *t@ = pointer to a source
39 * Use: Increments a target's refcount.
42 void target_inc(target
*t
) { t
->ref
++; }
44 /* --- @target_dec@ --- *
46 * Arguments: @target *t@ = pointer to a target
50 * Use: Decrements a target's refcount, destroying it if necessary.
53 void target_dec(target
*t
)
57 if (!t
->ref
) t
->ops
->destroy(t
);
60 /*----- That's all, folks -------------------------------------------------*/