~ubuntu-branches/ubuntu/wily/geany/wily

« back to all changes in this revision

Viewing changes to src/utils.h

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-12-10 07:43:26 UTC
  • mfrom: (3.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20111210074326-s8yqbew5i20h33tf
Tags: 0.21-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  - debian/patches/20_use_evince_viewer.patch:
     + use evince as viewer for pdf and dvi files
  - debian/patches/20_use_x_terminal_emulator.patch:
     + use x-terminal-emulator as terminal
  - debian/control
     + Add breaks on geany-plugins-common << 0.20
* Also fixes bugs:
  - Filter for MATLAB/Octave files filters everythign (LP: 885505)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *      utils.h - this file is part of Geany, a fast and lightweight IDE
3
3
 *
4
 
 *      Copyright 2005-2010 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5
 
 *      Copyright 2006-2010 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
 
4
 *      Copyright 2005-2011 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
 
5
 *      Copyright 2006-2011 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
6
6
 *
7
7
 *      This program is free software; you can redistribute it and/or modify
8
8
 *      it under the terms of the GNU General Public License as published by
18
18
 *      along with this program; if not, write to the Free Software
19
19
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
20
 *
21
 
 * $Id: utils.h 5389 2010-11-09 18:17:57Z ntrel $
 
21
 * $Id: utils.h 5906 2011-09-02 21:44:44Z colombanw $
22
22
 */
23
23
 
24
24
/**
35
35
 
36
36
/** Returns TRUE if @a ptr points to a non-zero value. */
37
37
#define NZV(ptr) \
38
 
        (G_LIKELY((ptr)) && G_LIKELY((ptr)[0]))
 
38
        ((ptr) && (ptr)[0])
39
39
 
40
40
/**
41
41
 *  Frees @a ptr (if not @c NULL), then assigns @a result to it.
84
84
 * @param idx @c guint index into @a ptr_array.
85
85
 * @param ptr_array @c GPtrArray to traverse. */
86
86
#define foreach_ptr_array(item, idx, ptr_array) \
87
 
        for (idx = 0, item = g_ptr_array_index(ptr_array, 0); \
88
 
                idx < ptr_array->len; ++idx, item = g_ptr_array_index(ptr_array, idx))
 
87
        for (idx = 0, item = ((ptr_array)->len > 0 ? g_ptr_array_index((ptr_array), 0) : NULL); \
 
88
                idx < (ptr_array)->len; ++idx, item = g_ptr_array_index((ptr_array), idx))
89
89
 
90
90
/** Iterates all the nodes in @a list.
91
91
 * @param node should be a (@c GList*).
132
132
 
133
133
void utils_open_browser(const gchar *uri);
134
134
 
135
 
gint utils_get_line_endings(const gchar* buffer, glong size);
 
135
gint utils_get_line_endings(const gchar* buffer, gsize size);
136
136
 
137
137
gboolean utils_isbrace(gchar c, gboolean include_angles);
138
138
 
142
142
 
143
143
gchar *utils_find_open_xml_tag(const gchar sel[], gint size);
144
144
 
 
145
const gchar *utils_find_open_xml_tag_pos(const gchar sel[], gint size);
 
146
 
145
147
gboolean utils_is_short_html_tag(const gchar *tag_name);
146
148
 
147
149
void utils_ensure_same_eol_characters(GString *string, gint target_eol_mode);
168
170
 
169
171
gchar *utils_get_hostname(void);
170
172
 
 
173
gint utils_string_find(GString *haystack, gint start, gint end, const gchar *needle);
 
174
 
 
175
gint utils_string_replace(GString *str, gint pos, gint len, const gchar *replace);
 
176
 
171
177
guint utils_string_replace_all(GString *haystack, const gchar *needle, const gchar *replace);
172
178
 
173
179
guint utils_string_replace_first(GString *haystack, const gchar *needle, const gchar *replace);
234
240
 
235
241
gboolean utils_str_has_upper(const gchar *str);
236
242
 
237
 
gint utils_is_file_writeable(const gchar *locale_filename);
 
243
gint utils_is_file_writable(const gchar *locale_filename);
238
244
 
239
245
 
240
246
gboolean utils_spawn_sync(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,
247
253
 
248
254
gint utils_str_casecmp(const gchar *s1, const gchar *s2);
249
255
 
250
 
const gchar *utils_build_path(const gchar *first, ...) G_GNUC_NULL_TERMINATED;
 
256
gchar *utils_build_path(const gchar *first, ...) G_GNUC_NULL_TERMINATED;
 
257
 
 
258
gchar *utils_make_filename(const gchar *path, ...) G_GNUC_NULL_TERMINATED;
251
259
 
252
260
gchar *utils_get_path_from_uri(const gchar *uri);
253
261