[geany/geany] 9ae93e: Check return value of write_tag()

Jiří Techet git-noreply at xxxxx
Fri Jun 10 21:57:33 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Fri, 06 May 2016 19:08:24 UTC
Commit:      9ae93e34a00bcc2e3f3a8c672443f5d5db177ce8
             https://github.com/geany/geany/commit/9ae93e34a00bcc2e3f3a8c672443f5d5db177ce8

Log Message:
-----------
Check return value of write_tag()

If we were strict, we should check every single fprintf() int write_tag()
but it's highly improbable that some of the middle fprintf()s fail and
the last one doesn't so the current implementation of write_tag() is
probably sufficient.


Modified Paths:
--------------
    tagmanager/src/tm_source_file.c

Modified: tagmanager/src/tm_source_file.c
8 lines changed, 6 insertions(+), 2 deletions(-)
===================================================================
@@ -576,6 +576,7 @@ gboolean tm_source_file_write_tags_file(const gchar *tags_file, GPtrArray *tags_
 {
 	guint i;
 	FILE *fp;
+	gboolean ret = TRUE;
 
 	g_return_val_if_fail(tags_array && tags_file, FALSE);
 
@@ -588,13 +589,16 @@ gboolean tm_source_file_write_tags_file(const gchar *tags_file, GPtrArray *tags_
 	{
 		TMTag *tag = TM_TAG(tags_array->pdata[i]);
 
-		write_tag(tag, fp, tm_tag_attr_type_t
+		ret = write_tag(tag, fp, tm_tag_attr_type_t
 		  | tm_tag_attr_scope_t | tm_tag_attr_arglist_t | tm_tag_attr_vartype_t
 		  | tm_tag_attr_pointer_t);
+
+		if (!ret)
+			break;
 	}
 	fclose(fp);
 
-	return TRUE;
+	return ret;
 }
 
 /* add argument list of __init__() Python methods to the class tag */



--------------
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