[bug-buddy/remove_breakpad] Fix issues from http://fpaste.org/iIwx/ * Add license header to elf.c * Fix code style * Fix help st



commit 1d1225b700f45f7260e1a02b95ee63a1002f8253
Author: Fernando Herrera <fherrera onirica com>
Date:   Mon Jun 7 19:17:42 2010 +0200

    Fix issues from http://fpaste.org/iIwx/
    * Add license header to elf.c
    * Fix code style
    * Fix help string for command line

 src/bug-buddy.c |   24 +++++++++++++-----------
 src/elf.c       |   26 ++++++++++++++++++++++----
 2 files changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/src/bug-buddy.c b/src/bug-buddy.c
index ef76ca2..331ac53 100644
--- a/src/bug-buddy.c
+++ b/src/bug-buddy.c
@@ -1857,8 +1857,10 @@ static gboolean
 has_gdb (void)
 {
 	gchar *gdb = g_find_program_in_path ("gdb");
-	if (gdb)
+	if (gdb) {
+		g_free (gdb);
 		return TRUE;
+	}
 
 	return FALSE;
 }
@@ -1866,7 +1868,7 @@ has_gdb (void)
 static gboolean
 is_gnome_hacker (void)
 {
-	if (g_getenv("GNOME_HACKER"))
+	if (g_getenv ("GNOME_HACKER"))
 		return TRUE;
 
 	return FALSE;
@@ -1882,17 +1884,17 @@ run_gdb (const gchar *appname, pid_t pid)
 
 	title = g_strdup_printf ("Debugging %s", appname);
 
-	exec_str = g_strdup_printf("gnome-terminal "
-				 "--title=\"%s\" "
-				 "--disable-factory "
-				 "--command=\"gdb %s %d\"",
-				title, appname, (int)pid);
-				g_free (title);
+	exec_str = g_strdup_printf ("gnome-terminal "
+				    "--title=\"%s\" "
+				    "--disable-factory "
+				    "--command=\"gdb %s %d\"",
+				    title, appname, (int) pid);
+	g_free (title);
 	res = g_spawn_command_line_sync (exec_str, NULL, NULL,
 					 NULL, &error);
-	g_free(exec_str);
+	g_free (exec_str);
 	if (!res) {
-		g_warning("Couldn't run debugger\n");
+		g_warning ("Couldn't run debugger\n");
 		return FALSE;
 	}
 
@@ -1996,7 +1998,7 @@ main (int argc, char *argv[])
 
 	if (gopt_data.app_file && gopt_data.pid == 0 && 
             gopt_data.include_file == NULL) {
-		buddy_error (NULL, _("Either --pid , --include arguments are required.\n"));	
+		buddy_error (NULL, _("Either --pid or --include arguments are required.\n"));	
 		return 0;
 	}
 
diff --git a/src/elf.c b/src/elf.c
index 6a16732..5f8dac2 100644
--- a/src/elf.c
+++ b/src/elf.c
@@ -1,3 +1,21 @@
+/* bug-buddy bug submitting program
+ *
+ * Copyright (C) 2008 - 2010 Fernando Herrera <fherrera onirica com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
 #include <libelf.h>
 #include <gelf.h>
 #include <stdio.h>
@@ -53,7 +71,7 @@ elf_has_debug_symbols (gint pid)
 	if (pid <= 0)
 		return FALSE;
 
-	if (elf_version(EV_CURRENT) == EV_NONE ) {
+	if (elf_version (EV_CURRENT) == EV_NONE ) {
 		fprintf(stderr, "Elf library out of date!n");
 		return FALSE;
 	}
@@ -64,14 +82,14 @@ elf_has_debug_symbols (gint pid)
 	if (!filename)
 		return FALSE;
 
-	fd = open(filename, O_RDONLY);
+	fd = open (filename, O_RDONLY);
 
-	if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL){
+	if ((elf = elf_begin (fd, ELF_C_READ, NULL)) == NULL){
 		close (fd);
 		return FALSE;
 	}
 	gelf_getehdr (elf, &elf_header);
-	while ((section = elf_nextscn(elf, section)) != 0) {
+	while ((section = elf_nextscn (elf, section)) != 0) {
 		GElf_Shdr shdr;
 
 		/* Check for stabs debug information */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]