[geany/geany] d6c98f: Merge pull request #966 from codebrainz/private-globals
Colomban Wendling
git-noreply at xxxxx
Thu Jun 23 21:34:19 UTC 2016
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Thu, 23 Jun 2016 21:34:19 UTC
Commit: d6c98f5ae671a2fd0cb5102a9927a4c2f34f4986
https://github.com/geany/geany/commit/d6c98f5ae671a2fd0cb5102a9927a4c2f34f4986
Log Message:
-----------
Merge pull request #966 from codebrainz/private-globals
Privatize global and publicize docs
Modified Paths:
--------------
src/document.c
src/document.h
src/filetypes.c
src/plugindata.h
Modified: src/document.c
22 lines changed, 2 insertions(+), 20 deletions(-)
===================================================================
@@ -86,24 +86,6 @@
GeanyFilePrefs file_prefs;
-
-
-/** Dynamic array of GeanyDocument pointers.
- * Once a pointer is added to this, it is never freed. This means the same document pointer
- * can represent a different document later on, or it may have been closed and become invalid.
- * For this reason, you should use document_find_by_id() instead of storing
- * document pointers over time if there is a chance the user can close the
- * document.
- *
- * @warning You must check @c GeanyDocument::is_valid when iterating over this array.
- * This is done automatically if you use the foreach_document() macro.
- *
- * @note
- * Never assume that the order of document pointers is the same as the order of notebook tabs.
- * One reason is that notebook tabs can be reordered.
- * Use @c document_get_from_page() to lookup a document from a notebook tab number.
- *
- * @see documents. */
GPtrArray *documents_array = NULL;
@@ -3331,9 +3313,9 @@ const GdkColor *document_get_status_color(GeanyDocument *doc)
}
-/** Accessor function for @ref documents_array items.
+/** Accessor function for @ref GeanyData::documents_array items.
* @warning Always check the returned document is valid (@c doc->is_valid).
- * @param idx @c documents_array index.
+ * @param idx @c GeanyData::documents_array index.
* @return @transfer{none} @nullable The document, or @c NULL if @a idx is out of range.
*
* @since 0.16
Modified: src/document.h
9 lines changed, 4 insertions(+), 5 deletions(-)
===================================================================
@@ -78,7 +78,7 @@ GType document_get_type (void);
**/
typedef struct GeanyDocument
{
- /** Flag used to check if this document is valid when iterating @ref documents_array. */
+ /** Flag used to check if this document is valid when iterating @ref GeanyData::documents_array. */
gboolean is_valid;
gint index; /**< Index in the documents array. */
/** Whether this document supports source code symbols(tags) to show in the sidebar. */
@@ -121,9 +121,7 @@ typedef struct GeanyDocument
}
GeanyDocument;
-extern GPtrArray *documents_array;
-
-/** Wraps @ref documents_array so it can be used with C array syntax.
+/** Wraps @ref GeanyData::documents_array so it can be used with C array syntax.
* @warning Always check the returned document is valid (@c doc->is_valid).
*
* Example: @code GeanyDocument *doc = documents[i]; @endcode
@@ -140,7 +138,7 @@ extern GPtrArray *documents_array;
/** Iterates all valid document indexes.
* Use like a @c for statement.
- * @param i @c guint index for @ref documents_array.
+ * @param i @c guint index for @ref GeanyData::documents_array.
*
* Example:
* @code
@@ -234,6 +232,7 @@ GeanyDocument *document_find_by_id(guint id);
#endif
extern GeanyFilePrefs file_prefs;
+extern GPtrArray *documents_array;
/* These functions will replace the older functions. For now they have a documents_ prefix. */
Modified: src/filetypes.c
14 lines changed, 0 insertions(+), 14 deletions(-)
===================================================================
@@ -55,22 +55,8 @@
#define GEANY_FILETYPE_SEARCH_LINES 2 /* lines of file to search for filetype */
-/** Dynamic array of filetype pointers
- *
- * List the list is dynamically expanded for custom filetypes filetypes so don't expect
- * the list of known filetypes to be a constant.
- *
- * @elementtype{GeanyFiletype}
- * */
GPtrArray *filetypes_array = NULL;
-
static GHashTable *filetypes_hash = NULL; /* Hash of filetype pointers based on name keys */
-
-/** List of filetype pointers sorted by name, but with @c filetypes_index(GEANY_FILETYPES_NONE)
- * first, as this is usually treated specially.
- * The list does not change (after filetypes have been initialized), so you can use
- * @code g_slist_nth_data(filetypes_by_title, n) @endcode and expect the same result at different times.
- * @see filetypes_get_sorted_by_name(). */
GSList *filetypes_by_title = NULL;
Modified: src/plugindata.h
34 lines changed, 31 insertions(+), 3 deletions(-)
===================================================================
@@ -171,8 +171,31 @@ typedef struct GeanyData
{
struct GeanyApp *app; /**< Geany application data fields */
struct GeanyMainWidgets *main_widgets; /**< Important widgets in the main window */
- GPtrArray *documents_array; /**< See document.h#documents_array. @elementtype{GeanyDocument} */
- GPtrArray *filetypes_array; /**< Dynamic array of GeanyFiletype pointers. @elementtype{GeanyFiletype} */
+ /** Dynamic array of GeanyDocument pointers.
+ * Once a pointer is added to this, it is never freed. This means the same document pointer
+ * can represent a different document later on, or it may have been closed and become invalid.
+ * For this reason, you should use document_find_by_id() instead of storing
+ * document pointers over time if there is a chance the user can close the
+ * document.
+ *
+ * @warning You must check @c GeanyDocument::is_valid when iterating over this array.
+ * This is done automatically if you use the foreach_document() macro.
+ *
+ * @note
+ * Never assume that the order of document pointers is the same as the order of notebook tabs.
+ * One reason is that notebook tabs can be reordered.
+ * Use @c document_get_from_page() to lookup a document from a notebook tab number.
+ *
+ * @see documents. */
+ GPtrArray *documents_array;
+ /** Dynamic array of filetype pointers
+ *
+ * List the list is dynamically expanded for custom filetypes filetypes so don't expect
+ * the list of known filetypes to be a constant.
+ *
+ * @elementtype{GeanyFiletype}
+ */
+ GPtrArray *filetypes_array;
struct GeanyPrefs *prefs; /**< General settings */
struct GeanyInterfacePrefs *interface_prefs; /**< Interface settings */
struct GeanyToolbarPrefs *toolbar_prefs; /**< Toolbar settings */
@@ -182,7 +205,12 @@ typedef struct GeanyData
struct GeanyToolPrefs *tool_prefs; /**< Tool settings */
struct GeanyTemplatePrefs *template_prefs; /**< Template settings */
gpointer *_compat; /* Remove field on next ABI break (abi-todo) */
- GSList *filetypes_by_title; /**< See filetypes.h#filetypes_by_title. */
+ /** List of filetype pointers sorted by name, but with @c filetypes_index(GEANY_FILETYPES_NONE)
+ * first, as this is usually treated specially.
+ * The list does not change (after filetypes have been initialized), so you can use
+ * @code g_slist_nth_data(filetypes_by_title, n) @endcode and expect the same result at different times.
+ * @see filetypes_get_sorted_by_name(). */
+ GSList *filetypes_by_title;
/** @gironly
* Global object signalling events via signals
*
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list