Miscellaneous Utility Functions

Miscellaneous Utility Functions — Various utility functions

Stability Level

Stable, unless otherwise indicated

Synopsis


#include <exo/exo.h>

void                exo_noop                            (void);
gint                exo_noop_one                        (void);
gint                exo_noop_zero                       (void);
gpointer            exo_noop_null                       (void);
gboolean            exo_noop_true                       (void);
gboolean            exo_noop_false                      (void);
#define             exo_atomic_inc                      (value)
#define             exo_atomic_dec                      (value)

Description

This module contains various utility functions that extend the basic utility functions provided by the GLib library.

Details

exo_noop ()

void                exo_noop                            (void);

This function has no effect. It does nothing but returning instantly. It is mostly useful in situations that require a function to be called, but that function does not need to do anything useful.

Since 0.3.1


exo_noop_one ()

gint                exo_noop_one                        (void);

This function has no effect but simply returns the integer value 1. It is mostly useful in situations where you just need a function that returns 1, but don't want to perform any other actions.

Returns :

the integer value 1.

Since 0.3.1


exo_noop_zero ()

gint                exo_noop_zero                       (void);

This function has no effect but simply returns the integer value 0. It is mostly useful in situations where you just need a function that returns 0, but don't want to perform any other actions.

Returns :

the integer value 0.

Since 0.3.1


exo_noop_null ()

gpointer            exo_noop_null                       (void);

This function has no effect but simply returns a NULL pointer. It is mostly useful in situations where you just need a function that returns NULL, but don't want to perform any other actions.

Returns :

a NULL pointer.

Since 0.3.1


exo_noop_true ()

gboolean            exo_noop_true                       (void);

This function has no effect, but simply returns the boolean value TRUE. It is mostly useful in situations where you just need a function that returns TRUE, but don't want to perform any other actions.

Returns :

the boolean value TRUE.

Since 0.3.1


exo_noop_false ()

gboolean            exo_noop_false                      (void);

This function has no effect, but simply returns the boolean value FALSE. It is mostly useful in situations where you just need a function that returns FALSE, but don't want to perform any other actions.

Returns :

the boolean value FALSE.

Since 0.3.1


exo_atomic_inc()

#define exo_atomic_inc(value) G_STMT_START{ g_atomic_int_inc ((value)); }G_STMT_END

Increments the integer at value by one in an atomic fashion. The advantage over using g_atomic_int_inc() is that calls to this function can be inlined.

value :

a pointer to the integer value to increment.

Since 0.3.1


exo_atomic_dec()

#define exo_atomic_dec(value) (g_atomic_int_dec_and_test ((value)))

Decrements the integer at value by one in an atomic fashion and returns TRUE if the value dropped to zero by this operation, else FALSE. The advantage over using g_atomic_int_dec() is that calls to this function can be inlined.

value :

a pointer to the integer value to decrement.

Returns :

TRUE if value dropped to zero, else FALSE.

Since 0.3.1

See Also

GLib Atomic Operations