mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
gstinfo: remove the vasprintf fallback
We are always building our printf implementation, even when GST_DEBUG is disabled, since we are exposing api (gst_print*) that's dependant on our printf behavior. We don't need to keep __gst_info_fallback_vasprintf around anymore. Close #640 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/739>
This commit is contained in:
parent
ca47012a55
commit
d75a69ec95
3 changed files with 2 additions and 55 deletions
|
@ -348,12 +348,6 @@ extern GstClockTime _priv_gst_start_time;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GST_DISABLE_GST_DEBUG
|
|
||||||
/* for _gst_element_error_printf */
|
|
||||||
#define __gst_vasprintf __gst_info_fallback_vasprintf
|
|
||||||
int __gst_vasprintf (char **result, char const *format, va_list args);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**** objects made opaque until the private bits have been made private ****/
|
/**** objects made opaque until the private bits have been made private ****/
|
||||||
|
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
|
|
@ -104,9 +104,7 @@
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
#include "glib-compat-private.h"
|
#include "glib-compat-private.h"
|
||||||
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
|
||||||
#include "printf/printf.h"
|
#include "printf/printf.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Element signals and args */
|
/* Element signals and args */
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -109,6 +109,8 @@
|
||||||
#ifdef HAVE_VALGRIND_VALGRIND_H
|
#ifdef HAVE_VALGRIND_VALGRIND_H
|
||||||
# include <valgrind/valgrind.h>
|
# include <valgrind/valgrind.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* GST_DISABLE_GST_DEBUG */
|
||||||
|
|
||||||
#include <glib/gprintf.h> /* g_sprintf */
|
#include <glib/gprintf.h> /* g_sprintf */
|
||||||
|
|
||||||
/* our own printf implementation with custom extensions to %p for caps etc. */
|
/* our own printf implementation with custom extensions to %p for caps etc. */
|
||||||
|
@ -117,10 +119,6 @@
|
||||||
|
|
||||||
static char *gst_info_printf_pointer_extension_func (const char *format,
|
static char *gst_info_printf_pointer_extension_func (const char *format,
|
||||||
void *ptr);
|
void *ptr);
|
||||||
#else /* GST_DISABLE_GST_DEBUG */
|
|
||||||
|
|
||||||
#include <glib/gprintf.h>
|
|
||||||
#endif /* !GST_DISABLE_GST_DEBUG */
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h> /* getpid on UNIX */
|
# include <unistd.h> /* getpid on UNIX */
|
||||||
|
@ -2598,46 +2596,6 @@ _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
|
||||||
#endif /* GST_REMOVE_DISABLED */
|
#endif /* GST_REMOVE_DISABLED */
|
||||||
#endif /* GST_DISABLE_GST_DEBUG */
|
#endif /* GST_DISABLE_GST_DEBUG */
|
||||||
|
|
||||||
/* Need this for _gst_element_error_printf even if GST_REMOVE_DISABLED is set:
|
|
||||||
* fallback function that cleans up the format string and replaces all pointer
|
|
||||||
* extension formats with plain %p. */
|
|
||||||
#ifdef GST_DISABLE_GST_DEBUG
|
|
||||||
int
|
|
||||||
__gst_info_fallback_vasprintf (char **result, char const *format, va_list args)
|
|
||||||
{
|
|
||||||
gchar *clean_format, *c;
|
|
||||||
gsize len;
|
|
||||||
|
|
||||||
if (format == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
clean_format = g_strdup (format);
|
|
||||||
c = clean_format;
|
|
||||||
while ((c = strstr (c, "%p\a"))) {
|
|
||||||
if (c[3] < 'A' || c[3] > 'Z') {
|
|
||||||
c += 3;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
len = strlen (c + 4);
|
|
||||||
memmove (c + 2, c + 4, len + 1);
|
|
||||||
c += 2;
|
|
||||||
}
|
|
||||||
while ((c = strstr (clean_format, "%P"))) /* old GST_PTR_FORMAT */
|
|
||||||
c[1] = 'p';
|
|
||||||
while ((c = strstr (clean_format, "%Q"))) /* old GST_SEGMENT_FORMAT */
|
|
||||||
c[1] = 'p';
|
|
||||||
|
|
||||||
len = g_vasprintf (result, clean_format, args);
|
|
||||||
|
|
||||||
g_free (clean_format);
|
|
||||||
|
|
||||||
if (*result == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_info_vasprintf:
|
* gst_info_vasprintf:
|
||||||
* @result: (out): the resulting string
|
* @result: (out): the resulting string
|
||||||
|
@ -2661,9 +2619,6 @@ __gst_info_fallback_vasprintf (char **result, char const *format, va_list args)
|
||||||
gint
|
gint
|
||||||
gst_info_vasprintf (gchar ** result, const gchar * format, va_list args)
|
gst_info_vasprintf (gchar ** result, const gchar * format, va_list args)
|
||||||
{
|
{
|
||||||
/* This will fallback to __gst_info_fallback_vasprintf() via a #define in
|
|
||||||
* gst_private.h if the debug system is disabled which will remove the gst
|
|
||||||
* specific printf format specifiers */
|
|
||||||
return __gst_vasprintf (result, format, args);
|
return __gst_vasprintf (result, format, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue