Git init
[external/pango1.0.git] / debian / patches / 10_scan-module-files-in-dirs.patch
1 Index: pango1.0-1.16.0/pango/modules.c
2 ===================================================================
3 --- pango1.0-1.16.0.orig/pango/modules.c        2007-01-23 00:41:43.000000000 +0100
4 +++ pango1.0-1.16.0/pango/modules.c     2007-03-07 11:16:16.000000000 +0100
5 @@ -40,6 +40,9 @@
6  #define PANGO_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((module), PANGO_TYPE_MODULE, PangoModule))
7  #define PANGO_IS_MODULE(module)  (G_TYPE_CHECK_INSTANCE_TYPE ((module), PANGO_TYPE_MODULE))
8  
9 +#define MODULEFILEEXT ".modules"
10 +#define MODULEFILEEXT_LEN ((int) strlen (MODULEFILEEXT))
11 +
12  typedef struct _PangoMapInfo PangoMapInfo;
13  typedef struct _PangoEnginePair PangoEnginePair;
14  typedef struct _PangoSubmap PangoSubmap;
15 @@ -519,11 +522,36 @@
16  
17    while (n-- > 0)
18      {
19 -      module_file = g_fopen (files[n], "r");
20 -      if (module_file)
21 +      GDir *dir = g_dir_open (files[n], 0, NULL);
22 +      if (dir)
23         {
24 -         process_module_file(module_file);
25 -         fclose(module_file);
26 +         const char *dent;
27 +
28 +         while ((dent = g_dir_read_name (dir)))
29 +           {
30 +             int len = strlen (dent);
31 +             if (len > MODULEFILEEXT_LEN && strcmp (dent + len - MODULEFILEEXT_LEN, MODULEFILEEXT) == 0)
32 +               {
33 +                 gchar *pathname = g_build_filename (files[n], dent, NULL);
34 +                 module_file = g_fopen (pathname, "r");
35 +                 if (module_file)
36 +                   {
37 +                     process_module_file(module_file);
38 +                     fclose(module_file);
39 +                   }
40 +                 g_free (pathname);
41 +               }
42 +           }
43 +         g_dir_close (dir);
44 +       }
45 +      else
46 +       {
47 +         module_file = g_fopen (files[n], "r");
48 +         if (module_file)
49 +           {
50 +             process_module_file(module_file);
51 +             fclose(module_file);
52 +           }
53         }
54      }
55