[FFmpeg-cvslog] vf_frei0r: refactor library loading from env variable

Vittorio Giovara git at videolan.org
Tue Mar 11 13:12:01 CET 2014


ffmpeg | branch: release/2.2 | Vittorio Giovara <vittorio.giovara at gmail.com> | Thu Feb 27 12:29:37 2014 +0100| [6230de03aad9f26d5843afb913d196622e0b5b98] | committer: Reinhard Tartler

vf_frei0r: refactor library loading from env variable

strtok_r is not needed any more, so remove it from configure.

(cherry picked from commit 61b323ce7c7cdc101eadfd7de2203922b8a39e8d)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6230de03aad9f26d5843afb913d196622e0b5b98
---

 configure               |    6 ++----
 libavfilter/vf_frei0r.c |   18 ++++++++++++------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index ae504da..1554e0a 100755
--- a/configure
+++ b/configure
@@ -1404,7 +1404,6 @@ HAVE_LIST="
     soundcard_h
     strerror_r
     strptime
-    strtok_r
     struct_addrinfo
     struct_group_source_req
     struct_ip_mreq_source
@@ -2008,9 +2007,9 @@ boxblur_filter_deps="gpl"
 cropdetect_filter_deps="gpl"
 delogo_filter_deps="gpl"
 drawtext_filter_deps="libfreetype"
-frei0r_filter_deps="frei0r dlopen strtok_r"
+frei0r_filter_deps="frei0r dlopen"
 frei0r_filter_extralibs='$ldl'
-frei0r_src_filter_deps="frei0r dlopen strtok_r"
+frei0r_src_filter_deps="frei0r dlopen"
 frei0r_src_filter_extralibs='$ldl'
 hqdn3d_filter_deps="gpl"
 interlace_filter_deps="gpl"
@@ -3836,7 +3835,6 @@ check_func_headers malloc.h _aligned_malloc     && enable aligned_malloc
 check_func  setrlimit
 check_func  strerror_r
 check_func  strptime
-check_func  strtok_r
 check_func  sched_getaffinity
 check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
 check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 0d0866a..b4f4ddf 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -232,12 +232,18 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
     }
 
     /* see: http://piksel.org/frei0r/1.2/spec/1.2/spec/group__pluglocations.html */
-    if ((path = av_strdup(getenv("FREI0R_PATH")))) {
-        char *p, *ptr = NULL;
-        for (p = path; p = strtok_r(p, ":", &ptr); p = NULL)
-            if (s->dl_handle = load_path(ctx, p, dl_name))
-                break;
-        av_free(path);
+    if (path = getenv("FREI0R_PATH")) {
+        while(*path) {
+            char *ptr = av_get_token((const char **)&path, ":");
+            if (!ptr)
+                return AVERROR(ENOMEM);
+            s->dl_handle = load_path(ctx, ptr, dl_name);
+            av_freep(&ptr);
+            if (s->dl_handle)
+                break;              /* found */
+            if (*path)
+                path++              /* skip ':' */
+        }
     }
     if (!s->dl_handle && (path = getenv("HOME"))) {
         char prefix[1024];



More information about the ffmpeg-cvslog mailing list