~ubuntu-branches/ubuntu/quantal/libxfce4util/quantal

« back to all changes in this revision

Viewing changes to libxfce4util/xfce-rc-simple.c

  • Committer: Package Import Robot
  • Author(s): Yves-Alexis Perez
  • Date: 2011-09-12 22:44:20 UTC
  • mfrom: (2.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20110912224420-ure8tf1r2wk7qcyh
Tags: 4.8.2-1
* New upstream release.
* debian/patches:
  - 01_add-desktop-base-in-config-dirs refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
14
 * Library General Public License for more details.
15
15
 *
16
 
 * You should have received a copy of the GNU Library General Public
17
 
 * License along with this library; if not, write to the
18
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
 
 * Boston, MA 02111-1307, USA.
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library; if not, write to the Free
 
18
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
 * Boston, MA 02110-1301 USA
20
20
 */
21
21
 
22
22
#ifdef HAVE_CONFIG_H
128
128
 
129
129
 
130
130
 
131
 
/* because strcmp is by far the most called function in this code, 
 
131
/* because strcmp is by far the most called function in this code,
132
132
 * we inline the comparison of the first character */
133
133
#define str_is_equal(a,b) (*(a) != *(b) ? FALSE : strcmp ((a), (b)) == 0)
134
134
 
144
144
    if (str_is_equal (group->name, name))
145
145
      return group;
146
146
 
147
 
  group         = _xfce_slice_new (Group);
 
147
  group         = g_slice_new (Group);
148
148
  group->name   = g_string_chunk_insert (simple->string_chunk, name);
149
149
  group->efirst = NULL;
150
150
  group->elast  = NULL;
188
188
        /* this point is reached when there is a .desktop file that lists a language specific key for something that had no language-neutral key yet.
189
189
           Example:
190
190
             b.desktop
191
 
             
 
191
 
192
192
             [Desktop Entry]
193
193
             Version=1.0
194
194
             Name=xyz
195
195
             GenericName[de_AT]=Test
196
 
             
 
196
 
197
197
           here GenericName[de_AT] will end up here.
198
198
           The previous way with g_return_val_if_fail would call an assertion failure and terminate the _whole application_(!!).
199
 
           
 
199
 
200
200
           Saner ways to react are either just ignoring GenericName[de_AT] altogether, or, alternatively, just set the normal GenericName
201
201
           to Test too (i.e. imply GenericName=Test).
202
 
           
 
202
 
203
203
           For now, we are just ignoring the line altogether. But we aren't assert-failing anymore and the apps dont crash anymore.
204
204
           */
205
205
        return NULL;
206
206
      }
207
207
      /* why you annoying macro, will you stop borking libxfceutil? thanks. DO NOT DO THAT: g_return_val_if_fail (locale == NULL, NULL); */
208
208
 
209
 
      entry         = _xfce_slice_new (Entry);
 
209
      entry         = g_slice_new (Entry);
210
210
      entry->key    = g_string_chunk_insert (simple->string_chunk, key);
211
211
      entry->value  = g_string_chunk_insert (simple->string_chunk, value);
212
212
      entry->lfirst = NULL;
263
263
      if (G_LIKELY (lentry == NULL))
264
264
        {
265
265
          /* create new localized entry */
266
 
          lentry         = _xfce_slice_new (LEntry);
 
266
          lentry         = g_slice_new (LEntry);
267
267
          lentry->locale = g_string_chunk_insert (simple->string_chunk, locale);
268
268
          lentry->value  = g_string_chunk_insert (simple->string_chunk, value);
269
269
 
557
557
static void
558
558
simple_entry_free (Entry *entry)
559
559
{
560
 
  LEntry *lentry;
561
 
  LEntry *next;
562
 
 
563
560
  /* release all lentries */
564
 
  for (lentry = entry->lfirst; lentry != NULL; lentry = next)
565
 
    {
566
 
      /* determine the next lentry */
567
 
      next = lentry->next;
568
 
 
569
 
      /* release this lentry */
570
 
      _xfce_slice_free (LEntry, lentry);
571
 
    }
 
561
  g_slice_free_chain (LEntry, entry->lfirst, next);
572
562
 
573
563
  /* release the entry */
574
 
  _xfce_slice_free (Entry, entry);
 
564
  g_slice_free (Entry, entry);
575
565
}
576
566
 
577
567
 
593
583
    }
594
584
 
595
585
  /* release the group */
596
 
  _xfce_slice_free (Group, group);
 
586
  g_slice_free (Group, group);
597
587
}
598
588
 
599
589
 
847
837
 
848
838
  if (group == NULL)
849
839
    return NULL;
850
 
  
 
840
 
851
841
  result = g_new (gchar *, 11);
852
842
  size   = 10;
853
843
  pos    = 0;
854
 
  
 
844
 
855
845
  for (entry = group->efirst; entry != NULL; entry = entry->next)
856
846
    {
857
847
      if (size == pos)