"Fossies" - the Fresh Open Source Software Archive

Member "zorp-7.0.4/lib/zorp/sessionid.h" (28 Oct 2019, 1470 Bytes) of package /linux/privat/zorp-7.0.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "sessionid.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 6.0.11_vs_7.0.1.

    1 /***************************************************************************
    2  *
    3  * Copyright (c) 2000-2015 BalaBit IT Ltd, Budapest, Hungary
    4  * Copyright (c) 2015-2018 BalaSys IT Ltd, Budapest, Hungary
    5  *
    6  * This program is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License as published by
    8  * the Free Software Foundation; either version 2 of the License, or
    9  * (at your option) any later version.
   10  *
   11  * This program is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  * GNU General Public License for more details.
   15  *
   16  * You should have received a copy of the GNU General Public License along
   17  * with this program; if not, write to the Free Software Foundation, Inc.,
   18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   19  *
   20  ***************************************************************************/
   21 
   22 #ifndef ZORP_SESSIONID_H_INCLUDED
   23 #define ZORP_SESSIONID_H_INCLUDED
   24 
   25 #include <glib.h>
   26 
   27 typedef gint ZSessionId;
   28 
   29 static inline ZSessionId
   30 z_session_id_get_next(volatile ZSessionId *id)
   31 {
   32 #if GLIB_CHECK_VERSION(2, 30, 0)
   33   /* In glib >= 2.30 g_atomic_int_exchange_and_add() is deprecated, but
   34    * g_atomic_int_add() has been changed to return the old value. */
   35   return g_atomic_int_add(id, 1);
   36 #else
   37   return g_atomic_int_exchange_and_add(id, 1);
   38 #endif
   39 }
   40 
   41 #endif