]> git.sesse.net Git - vlc/blob - src/modules/cache.c
Pass struct stat pointer when looking up a plugin in the cache
[vlc] / src / modules / cache.c
1 /*****************************************************************************
2  * cache.c: Plugins cache
3  *****************************************************************************
4  * Copyright (C) 2001-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Sam Hocevar <sam@zoy.org>
8  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
9  *          Hans-Peter Jansen <hpj@urpla.net>
10  *          Gildas Bazin <gbazin@videolan.org>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <vlc_common.h>
32 #include "libvlc.h"
33
34 #include <stdlib.h>                                      /* free(), strtol() */
35 #include <stdio.h>                                              /* sprintf() */
36 #include <string.h>                                              /* strdup() */
37 #include <vlc_plugin.h>
38 #include <errno.h>
39
40 #include <sys/types.h>
41 #include <sys/stat.h>
42 #ifdef HAVE_UNISTD_H
43 #   include <unistd.h>
44 #endif
45 #include <assert.h>
46
47 #include "config/configuration.h"
48
49 #include <vlc_fs.h>
50
51 #include "modules/modules.h"
52
53
54 /*****************************************************************************
55  * Local prototypes
56  *****************************************************************************/
57 #ifdef HAVE_DYNAMIC_PLUGINS
58 static int    CacheLoadConfig  ( module_t *, FILE * );
59
60 /* Sub-version number
61  * (only used to avoid breakage in dev version when cache structure changes) */
62 #define CACHE_SUBVERSION_NUM 15
63
64 /* Cache filename */
65 #define CACHE_NAME "plugins.dat"
66 /* Magic for the cache filename */
67 #define CACHE_STRING "cache "PACKAGE_NAME" "PACKAGE_VERSION
68
69
70 void CacheDelete( vlc_object_t *obj, const char *dir )
71 {
72     char *path;
73
74     assert( dir != NULL );
75
76     if( asprintf( &path, "%s"DIR_SEP CACHE_NAME, dir ) == -1 )
77         return;
78     msg_Dbg( obj, "removing plugins cache file %s", path );
79     vlc_unlink( path );
80     free( path );
81 }
82
83 /**
84  * Loads a plugins cache file.
85  *
86  * This function will load the plugin cache if present and valid. This cache
87  * will in turn be queried by AllocateAllPlugins() to see if it needs to
88  * actually load the dynamically loadable module.
89  * This allows us to only fully load plugins when they are actually used.
90  */
91 size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t ***r )
92 {
93     char *psz_filename;
94     FILE *file;
95     int i_size, i_read;
96     char p_cachestring[sizeof(CACHE_STRING)];
97     size_t i_cache;
98     int32_t i_marker;
99
100     assert( dir != NULL );
101
102     *r = NULL;
103     if( asprintf( &psz_filename, "%s"DIR_SEP CACHE_NAME, dir ) == -1 )
104         return 0;
105
106     msg_Dbg( p_this, "loading plugins cache file %s", psz_filename );
107
108     file = vlc_fopen( psz_filename, "rb" );
109     if( !file )
110     {
111         msg_Warn( p_this, "cannot read %s (%m)",
112                   psz_filename );
113         free( psz_filename );
114         return 0;
115     }
116     free( psz_filename );
117
118     /* Check the file is a plugins cache */
119     i_size = sizeof(CACHE_STRING) - 1;
120     i_read = fread( p_cachestring, 1, i_size, file );
121     if( i_read != i_size ||
122         memcmp( p_cachestring, CACHE_STRING, i_size ) )
123     {
124         msg_Warn( p_this, "This doesn't look like a valid plugins cache" );
125         fclose( file );
126         return 0;
127     }
128
129 #ifdef DISTRO_VERSION
130     /* Check for distribution specific version */
131     char p_distrostring[sizeof( DISTRO_VERSION )];
132     i_size = sizeof( DISTRO_VERSION ) - 1;
133     i_read = fread( p_distrostring, 1, i_size, file );
134     if( i_read != i_size ||
135         memcmp( p_distrostring, DISTRO_VERSION, i_size ) )
136     {
137         msg_Warn( p_this, "This doesn't look like a valid plugins cache" );
138         fclose( file );
139         return 0;
140     }
141 #endif
142
143     /* Check Sub-version number */
144     i_read = fread( &i_marker, 1, sizeof(i_marker), file );
145     if( i_read != sizeof(i_marker) || i_marker != CACHE_SUBVERSION_NUM )
146     {
147         msg_Warn( p_this, "This doesn't look like a valid plugins cache "
148                   "(corrupted header)" );
149         fclose( file );
150         return 0;
151     }
152
153     /* Check header marker */
154     i_read = fread( &i_marker, 1, sizeof(i_marker), file );
155     if( i_read != sizeof(i_marker) ||
156         i_marker != ftell( file ) - (int)sizeof(i_marker) )
157     {
158         msg_Warn( p_this, "This doesn't look like a valid plugins cache "
159                   "(corrupted header)" );
160         fclose( file );
161         return 0;
162     }
163
164     if (fread( &i_cache, 1, sizeof(i_cache), file ) != sizeof(i_cache) )
165     {
166         msg_Warn( p_this, "This doesn't look like a valid plugins cache "
167                   "(file too short)" );
168         fclose( file );
169         return 0;
170     }
171
172     module_cache_t **pp_cache = malloc( i_cache * sizeof(*pp_cache) );
173     if( pp_cache == NULL )
174         i_cache = 0; /* don't load anything */
175
176 #define LOAD_IMMEDIATE(a) \
177     if( fread( (void *)&a, sizeof(char), sizeof(a), file ) != sizeof(a) ) goto error
178 #define LOAD_STRING(a) \
179 { \
180     a = NULL; \
181     if( ( fread( &i_size, sizeof(i_size), 1, file ) != 1 ) \
182      || ( i_size > 16384 ) ) \
183         goto error; \
184     if( i_size ) { \
185         char *psz = xmalloc( i_size ); \
186         if( fread( psz, i_size, 1, file ) != 1 ) { \
187             free( psz ); \
188             goto error; \
189         } \
190         if( psz[i_size-1] ) { \
191             free( psz ); \
192             goto error; \
193         } \
194         a = psz; \
195     } \
196 }
197
198     for( size_t i = 0; i < i_cache; i++ )
199     {
200         uint16_t i_size;
201         int i_submodules;
202
203         pp_cache[i] = xmalloc( sizeof(module_cache_t) );
204
205         /* Load common info */
206         LOAD_STRING( pp_cache[i]->path );
207         LOAD_IMMEDIATE( pp_cache[i]->mtime );
208         LOAD_IMMEDIATE( pp_cache[i]->size );
209
210         pp_cache[i]->p_module = vlc_module_create();
211
212         /* Load additional infos */
213         free( pp_cache[i]->p_module->psz_object_name );
214         LOAD_STRING( pp_cache[i]->p_module->psz_object_name );
215         LOAD_STRING( pp_cache[i]->p_module->psz_shortname );
216         LOAD_STRING( pp_cache[i]->p_module->psz_longname );
217         LOAD_STRING( pp_cache[i]->p_module->psz_help );
218
219         LOAD_IMMEDIATE( pp_cache[i]->p_module->i_shortcuts );
220         if( pp_cache[i]->p_module->i_shortcuts > MODULE_SHORTCUT_MAX )
221             goto error;
222         else if( pp_cache[i]->p_module->i_shortcuts == 0 )
223             pp_cache[i]->p_module->pp_shortcuts = NULL;
224         else
225         {
226             pp_cache[i]->p_module->pp_shortcuts =
227                     xmalloc( sizeof( char ** ) * pp_cache[i]->p_module->i_shortcuts );
228             for( unsigned j = 0; j < pp_cache[i]->p_module->i_shortcuts; j++ )
229                 LOAD_STRING( pp_cache[i]->p_module->pp_shortcuts[j] );
230         }
231
232         LOAD_STRING( pp_cache[i]->p_module->psz_capability );
233         LOAD_IMMEDIATE( pp_cache[i]->p_module->i_score );
234         LOAD_IMMEDIATE( pp_cache[i]->p_module->b_unloadable );
235
236         /* Config stuff */
237         if( CacheLoadConfig( pp_cache[i]->p_module, file ) != VLC_SUCCESS )
238             goto error;
239
240         LOAD_STRING( pp_cache[i]->p_module->psz_filename );
241         LOAD_STRING( pp_cache[i]->p_module->domain );
242         if( pp_cache[i]->p_module->domain != NULL )
243             vlc_bindtextdomain( pp_cache[i]->p_module->domain );
244
245         LOAD_IMMEDIATE( i_submodules );
246
247         while( i_submodules-- )
248         {
249             module_t *p_module = vlc_submodule_create( pp_cache[i]->p_module );
250             free( p_module->psz_object_name );
251             free( p_module->pp_shortcuts );
252             LOAD_STRING( p_module->psz_object_name );
253             LOAD_STRING( p_module->psz_shortname );
254             LOAD_STRING( p_module->psz_longname );
255             LOAD_STRING( p_module->psz_help );
256
257             LOAD_IMMEDIATE( p_module->i_shortcuts );
258             if( p_module->i_shortcuts > MODULE_SHORTCUT_MAX )
259                 goto error;
260             else if( p_module->i_shortcuts == 0 )
261                 p_module->pp_shortcuts = NULL;
262             else
263             {
264                 p_module->pp_shortcuts = xmalloc( sizeof( char ** ) * p_module->i_shortcuts );
265                 for( unsigned j = 0; j < p_module->i_shortcuts; j++ )
266                     LOAD_STRING( p_module->pp_shortcuts[j] );
267             }
268
269             LOAD_STRING( p_module->psz_capability );
270             LOAD_IMMEDIATE( p_module->i_score );
271             LOAD_IMMEDIATE( p_module->b_unloadable );
272             LOAD_STRING( p_module->domain );
273         }
274     }
275     fclose( file );
276
277     *r = pp_cache;
278     return i_cache;
279
280  error:
281
282     msg_Warn( p_this, "plugins cache not loaded (corrupted)" );
283
284     /* TODO: cleanup */
285     fclose( file );
286     return 0;
287 }
288
289
290 static int CacheLoadConfig( module_t *p_module, FILE *file )
291 {
292     uint32_t i_lines;
293     uint16_t i_size;
294
295     /* Calculate the structure length */
296     LOAD_IMMEDIATE( p_module->i_config_items );
297     LOAD_IMMEDIATE( p_module->i_bool_items );
298
299     LOAD_IMMEDIATE( i_lines );
300
301     /* Allocate memory */
302     if (i_lines)
303     {
304         p_module->p_config =
305             (module_config_t *)calloc( i_lines, sizeof(module_config_t) );
306         if( p_module->p_config == NULL )
307         {
308             p_module->confsize = 0;
309             return VLC_ENOMEM;
310         }
311     }
312     p_module->confsize = i_lines;
313
314     /* Do the duplication job */
315     for (size_t i = 0; i < i_lines; i++ )
316     {
317         LOAD_IMMEDIATE( p_module->p_config[i] );
318
319         LOAD_STRING( p_module->p_config[i].psz_type );
320         LOAD_STRING( p_module->p_config[i].psz_name );
321         LOAD_STRING( p_module->p_config[i].psz_text );
322         LOAD_STRING( p_module->p_config[i].psz_longtext );
323         LOAD_STRING( p_module->p_config[i].psz_oldname );
324
325         if (IsConfigStringType (p_module->p_config[i].i_type))
326         {
327             LOAD_STRING (p_module->p_config[i].orig.psz);
328             p_module->p_config[i].value.psz =
329                     (p_module->p_config[i].orig.psz != NULL)
330                         ? strdup (p_module->p_config[i].orig.psz) : NULL;
331         }
332         else
333             memcpy (&p_module->p_config[i].value, &p_module->p_config[i].orig,
334                     sizeof (p_module->p_config[i].value));
335
336         p_module->p_config[i].b_dirty = false;
337
338         if( p_module->p_config[i].i_list )
339         {
340             if( p_module->p_config[i].ppsz_list )
341             {
342                 int j;
343                 p_module->p_config[i].ppsz_list =
344                     xmalloc( (p_module->p_config[i].i_list+1) * sizeof(char *));
345                 if( p_module->p_config[i].ppsz_list )
346                 {
347                     for( j = 0; j < p_module->p_config[i].i_list; j++ )
348                         LOAD_STRING( p_module->p_config[i].ppsz_list[j] );
349                     p_module->p_config[i].ppsz_list[j] = NULL;
350                 }
351             }
352             if( p_module->p_config[i].ppsz_list_text )
353             {
354                 int j;
355                 p_module->p_config[i].ppsz_list_text =
356                     xmalloc( (p_module->p_config[i].i_list+1) * sizeof(char *));
357                 if( p_module->p_config[i].ppsz_list_text )
358                 {
359                   for( j = 0; j < p_module->p_config[i].i_list; j++ )
360                       LOAD_STRING( p_module->p_config[i].ppsz_list_text[j] );
361                   p_module->p_config[i].ppsz_list_text[j] = NULL;
362                 }
363             }
364             if( p_module->p_config[i].pi_list )
365             {
366                 p_module->p_config[i].pi_list =
367                     xmalloc( (p_module->p_config[i].i_list + 1) * sizeof(int) );
368                 if( p_module->p_config[i].pi_list )
369                 {
370                     for (int j = 0; j < p_module->p_config[i].i_list; j++)
371                         LOAD_IMMEDIATE( p_module->p_config[i].pi_list[j] );
372                 }
373             }
374         }
375
376         if( p_module->p_config[i].i_action )
377         {
378             p_module->p_config[i].ppf_action =
379                 xmalloc( p_module->p_config[i].i_action * sizeof(void *) );
380             p_module->p_config[i].ppsz_action_text =
381                 xmalloc( p_module->p_config[i].i_action * sizeof(char *) );
382
383             for (int j = 0; j < p_module->p_config[i].i_action; j++)
384             {
385                 p_module->p_config[i].ppf_action[j] = NULL;
386                 LOAD_STRING( p_module->p_config[i].ppsz_action_text[j] );
387             }
388         }
389     }
390
391     return VLC_SUCCESS;
392
393  error:
394
395     return VLC_EGENERIC;
396 }
397
398 static int CacheSaveBank( FILE *file, module_cache_t *const *, size_t );
399
400 /*****************************************************************************
401  * SavePluginsCache: saves the plugins cache to a file
402  *****************************************************************************/
403 void CacheSave (vlc_object_t *p_this, const char *dir,
404                 module_cache_t *const *pp_cache, size_t n)
405 {
406     char *filename, *tmpname;
407
408     if (asprintf (&filename, "%s"DIR_SEP CACHE_NAME, dir ) == -1)
409         return;
410
411     if (asprintf (&tmpname, "%s.%"PRIu32, filename, (uint32_t)getpid ()) == -1)
412     {
413         free (filename);
414         return;
415     }
416     msg_Dbg (p_this, "saving plugins cache %s", filename);
417
418     FILE *file = vlc_fopen (tmpname, "wb");
419     if (file == NULL)
420     {
421         if (errno != EACCES && errno != ENOENT)
422             msg_Warn (p_this, "cannot create %s (%m)", tmpname);
423         goto out;
424     }
425
426     if (CacheSaveBank (file, pp_cache, n))
427     {
428         msg_Warn (p_this, "cannot write %s (%m)", tmpname);
429         clearerr (file);
430         fclose (file);
431         vlc_unlink (tmpname);
432         goto out;
433     }
434
435 #if !defined( WIN32 ) && !defined( __OS2__ )
436     vlc_rename (tmpname, filename); /* atomically replace old cache */
437     fclose (file);
438 #else
439     vlc_unlink (filename);
440     fclose (file);
441     vlc_rename (tmpname, filename);
442 #endif
443 out:
444     free (filename);
445     free (tmpname);
446 }
447
448 static int CacheSaveConfig (FILE *, const module_t *);
449 static int CacheSaveSubmodule (FILE *, const module_t *);
450
451 static int CacheSaveBank (FILE *file, module_cache_t *const *pp_cache,
452                           size_t i_cache)
453 {
454     uint32_t i_file_size = 0;
455
456     /* Contains version number */
457     if (fputs (CACHE_STRING, file) == EOF)
458         goto error;
459 #ifdef DISTRO_VERSION
460     /* Allow binary maintaner to pass a string to detect new binary version*/
461     if (fputs( DISTRO_VERSION, file ) == EOF)
462         goto error;
463 #endif
464     /* Sub-version number (to avoid breakage in the dev version when cache
465      * structure changes) */
466     i_file_size = CACHE_SUBVERSION_NUM;
467     if (fwrite (&i_file_size, sizeof (i_file_size), 1, file) != 1 )
468         goto error;
469
470     /* Header marker */
471     i_file_size = ftell( file );
472     if (fwrite (&i_file_size, sizeof (i_file_size), 1, file) != 1)
473         goto error;
474
475     if (fwrite( &i_cache, sizeof (i_cache), 1, file) != 1)
476         goto error;
477
478 #define SAVE_IMMEDIATE( a ) \
479     if (fwrite (&a, sizeof(a), 1, file) != 1) \
480         goto error
481 #define SAVE_STRING( a ) \
482     { \
483         uint16_t i_size = (a != NULL) ? (strlen (a) + 1) : 0; \
484         if ((fwrite (&i_size, sizeof (i_size), 1, file) != 1) \
485          || (a && (fwrite (a, 1, i_size, file) != i_size))) \
486             goto error; \
487     } while(0)
488
489     for (unsigned i = 0; i < i_cache; i++)
490     {
491         uint32_t i_submodule;
492
493         /* Save common info */
494         SAVE_STRING( pp_cache[i]->path );
495         SAVE_IMMEDIATE( pp_cache[i]->mtime );
496         SAVE_IMMEDIATE( pp_cache[i]->size );
497
498         /* Save additional infos */
499         SAVE_STRING( pp_cache[i]->p_module->psz_object_name );
500         SAVE_STRING( pp_cache[i]->p_module->psz_shortname );
501         SAVE_STRING( pp_cache[i]->p_module->psz_longname );
502         SAVE_STRING( pp_cache[i]->p_module->psz_help );
503         SAVE_IMMEDIATE( pp_cache[i]->p_module->i_shortcuts );
504         for (unsigned j = 0; j < pp_cache[i]->p_module->i_shortcuts; j++)
505             SAVE_STRING( pp_cache[i]->p_module->pp_shortcuts[j] );
506
507         SAVE_STRING( pp_cache[i]->p_module->psz_capability );
508         SAVE_IMMEDIATE( pp_cache[i]->p_module->i_score );
509         SAVE_IMMEDIATE( pp_cache[i]->p_module->b_unloadable );
510
511         /* Config stuff */
512         if (CacheSaveConfig (file, pp_cache[i]->p_module))
513             goto error;
514
515         SAVE_STRING( pp_cache[i]->p_module->psz_filename );
516         SAVE_STRING( pp_cache[i]->p_module->domain );
517
518         i_submodule = pp_cache[i]->p_module->submodule_count;
519         SAVE_IMMEDIATE( i_submodule );
520         if( CacheSaveSubmodule( file, pp_cache[i]->p_module->submodule ) )
521             goto error;
522     }
523
524     if (fflush (file)) /* flush libc buffers */
525         goto error;
526     return 0; /* success! */
527
528 error:
529     return -1;
530 }
531
532 static int CacheSaveSubmodule( FILE *file, const module_t *p_module )
533 {
534     if( !p_module )
535         return 0;
536     if( CacheSaveSubmodule( file, p_module->next ) )
537         goto error;
538
539     SAVE_STRING( p_module->psz_object_name );
540     SAVE_STRING( p_module->psz_shortname );
541     SAVE_STRING( p_module->psz_longname );
542     SAVE_STRING( p_module->psz_help );
543     SAVE_IMMEDIATE( p_module->i_shortcuts );
544     for( unsigned j = 0; j < p_module->i_shortcuts; j++ )
545          SAVE_STRING( p_module->pp_shortcuts[j] );
546
547     SAVE_STRING( p_module->psz_capability );
548     SAVE_IMMEDIATE( p_module->i_score );
549     SAVE_IMMEDIATE( p_module->b_unloadable );
550     SAVE_STRING( p_module->domain );
551     return 0;
552
553 error:
554     return -1;
555 }
556
557
558 static int CacheSaveConfig (FILE *file, const module_t *p_module)
559 {
560     uint32_t i_lines = p_module->confsize;
561
562     SAVE_IMMEDIATE( p_module->i_config_items );
563     SAVE_IMMEDIATE( p_module->i_bool_items );
564     SAVE_IMMEDIATE( i_lines );
565
566     for (size_t i = 0; i < i_lines ; i++)
567     {
568         SAVE_IMMEDIATE( p_module->p_config[i] );
569
570         SAVE_STRING( p_module->p_config[i].psz_type );
571         SAVE_STRING( p_module->p_config[i].psz_name );
572         SAVE_STRING( p_module->p_config[i].psz_text );
573         SAVE_STRING( p_module->p_config[i].psz_longtext );
574         SAVE_STRING( p_module->p_config[i].psz_oldname );
575
576         if (IsConfigStringType (p_module->p_config[i].i_type))
577             SAVE_STRING( p_module->p_config[i].orig.psz );
578
579         if( p_module->p_config[i].i_list )
580         {
581             if( p_module->p_config[i].ppsz_list )
582             {
583                 for (int j = 0; j < p_module->p_config[i].i_list; j++)
584                     SAVE_STRING( p_module->p_config[i].ppsz_list[j] );
585             }
586
587             if( p_module->p_config[i].ppsz_list_text )
588             {
589                 for (int j = 0; j < p_module->p_config[i].i_list; j++)
590                     SAVE_STRING( p_module->p_config[i].ppsz_list_text[j] );
591             }
592             if( p_module->p_config[i].pi_list )
593             {
594                 for (int j = 0; j < p_module->p_config[i].i_list; j++)
595                     SAVE_IMMEDIATE( p_module->p_config[i].pi_list[j] );
596             }
597         }
598
599         for (int j = 0; j < p_module->p_config[i].i_action; j++)
600             SAVE_STRING( p_module->p_config[i].ppsz_action_text[j] );
601     }
602     return 0;
603
604 error:
605     return -1;
606 }
607
608 /*****************************************************************************
609  * CacheMerge: Merge a cache module descriptor with a full module descriptor.
610  *****************************************************************************/
611 void CacheMerge( vlc_object_t *p_this, module_t *p_cache, module_t *p_module )
612 {
613     (void)p_this;
614
615     p_cache->pf_activate = p_module->pf_activate;
616     p_cache->pf_deactivate = p_module->pf_deactivate;
617     p_cache->handle = p_module->handle;
618
619     /* FIXME: This looks too simplistic an algorithm to me. What if the module
620      * file was altered such that the number of order of submodules was
621      * altered... after VLC started -- Courmisch, 09/2008 */
622     module_t *p_child = p_module->submodule,
623              *p_cchild = p_cache->submodule;
624     while( p_child && p_cchild )
625     {
626         p_cchild->pf_activate = p_child->pf_activate;
627         p_cchild->pf_deactivate = p_child->pf_deactivate;
628         p_child = p_child->next;
629         p_cchild = p_cchild->next;
630     }
631
632     p_cache->b_loaded = true;
633     p_module->b_loaded = false;
634 }
635
636 /**
637  * Looks up a plugin file in a list of cached plugins.
638  */
639 module_t *CacheFind (module_bank_t *p_bank,
640                      const char *path, const struct stat *st)
641 {
642     module_cache_t **cache = p_bank->pp_loaded_cache;
643     size_t n = p_bank->i_loaded_cache;
644
645     for( size_t i = 0; i < n; i++ )
646         if( !strcmp( cache[i]->path, path )
647          && cache[i]->mtime == st->st_mtime
648          && cache[i]->size == st->st_size)
649        {
650             module_t *module = cache[i]->p_module;
651             cache[i]->p_module = NULL;
652             return module;
653        }
654
655     return NULL;
656 }
657
658 #endif /* HAVE_DYNAMIC_PLUGINS */