]> git.sesse.net Git - vlc/blobdiff - include/vlc_common.h
strsep does not need to be exported for now
[vlc] / include / vlc_common.h
index d44837134574a2232692cc2f7b25ab66e689ddff..65158d04126fd3ed7fb988df553c05f2ebb0782d 100644 (file)
@@ -106,6 +106,13 @@ typedef uint32_t vlc_fourcc_t;
 
 #endif
 
+/**
+ * Translate a vlc_fourcc into its string representation. This function
+ * assumes there is enough room in psz_fourcc to store 4 characters in.
+ *
+ * \param fcc a vlc_fourcc_t
+ * \param psz_fourcc string to store string representation of vlc_fourcc in
+ */
 static inline void __vlc_fourcc_to_char( vlc_fourcc_t fcc, char *psz_fourcc )
 {
     memcpy( psz_fourcc, &fcc, 4 );
@@ -440,7 +447,6 @@ struct vlc_list_t
 #define VLC_ENOMOD         -10                           /* Module not found */
 
 #define VLC_ENOOBJ         -20                           /* Object not found */
-#define VLC_EBADOBJ        -21                            /* Bad object type */
 
 #define VLC_ENOVAR         -30                         /* Variable not found */
 #define VLC_EBADVAR        -31                         /* Bad variable value */
@@ -514,10 +520,6 @@ typedef struct vlc_object_internals_t vlc_object_internals_t;
     char *psz_header;                                                       \
     int  i_flags;                                                           \
                                                                             \
-    /* Object access lock */                                                \
-    vlc_mutex_t  object_lock;                                               \
-    vlc_cond_t   object_wait;                                               \
-                                                                            \
     /* Object properties */                                                 \
     volatile bool b_error;                  /**< set by the object */ \
     volatile bool b_die;                   /**< set by the outside */ \
@@ -537,8 +539,12 @@ typedef struct vlc_object_internals_t vlc_object_internals_t;
 /**@}*/                                                                     \
 
 /* VLC_OBJECT: attempt at doing a clever cast */
-#define VLC_OBJECT( x ) \
-    (((vlc_object_t *)(x))+0*(x)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct)
+#ifdef __GNUC__
+# define VLC_OBJECT( x ) \
+    (((vlc_object_t *)(x))+0*(((typeof(x))0)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct))
+#else
+# define VLC_OBJECT( x ) ((vlc_object_t *)(x))
+#endif
 
 #define VLC_GC_MEMBERS                                                       \
 /** \name VLC_GC_MEMBERS                                                     \
@@ -555,32 +561,10 @@ struct gc_object_t
     VLC_GC_MEMBERS
 };
 
-static inline void __vlc_gc_incref( gc_object_t * p_gc )
-{
-    p_gc->i_gc_refcount ++;
-};
-
-static inline void __vlc_gc_decref( gc_object_t *p_gc )
-{
-    if( !p_gc ) return;
-
-    p_gc->i_gc_refcount -- ;
-
-    if( p_gc->i_gc_refcount == 0 )
-    {
-        p_gc->pf_destructor( p_gc );
-        /* Do not use the p_gc pointer from now on ! */
-    }
-}
-
-static inline void
-__vlc_gc_init( gc_object_t * p_gc, void (*pf_destructor)( gc_object_t * ),
-               void * arg)
-{
-    p_gc->i_gc_refcount = 1;
-    p_gc->pf_destructor = pf_destructor;
-    p_gc->p_destructor_arg = arg;
-}
+VLC_EXPORT(void, __vlc_gc_incref, ( gc_object_t * p_gc ));
+VLC_EXPORT(void, __vlc_gc_decref, ( gc_object_t * p_gc ));
+VLC_EXPORT(void, __vlc_gc_init, ( gc_object_t * p_gc,
+    void (*pf_destructor)( gc_object_t * ), void * arg));
 
 #define vlc_gc_incref( a ) __vlc_gc_incref( (gc_object_t *)a )
 #define vlc_gc_decref( a ) __vlc_gc_decref( (gc_object_t *)a )
@@ -648,9 +632,7 @@ VLC_EXPORT( char const *, vlc_error, ( int ) );
 #include <vlc_arrays.h>
 
 /* MSB (big endian)/LSB (little endian) conversions - network order is always
- * MSB, and should be used for both network communications and files. Note that
- * byte orders other than little and big endians are not supported, but only
- * the VAX seems to have such exotic properties. */
+ * MSB, and should be used for both network communications and files. */
 static inline uint16_t U16_AT( const void * _p )
 {
     const uint8_t * p = (const uint8_t *)_p;
@@ -773,6 +755,7 @@ VLC_EXPORT( size_t, vlc_strlcpy, ( char *, const char *, size_t ) );
 VLC_EXPORT( long long, vlc_strtoll, ( const char *nptr, char **endptr, int base ) );
 
 VLC_EXPORT( char *, vlc_strcasestr, ( const char *s1, const char *s2 ) );
+char *vlc_strsep( char **, const char * );
 
 #if defined(WIN32) || defined(UNDER_CE)
 /* win32, cl and icl support */