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

gEDA-cvs: CVS update: gattrib.c



  User: ahvezda 
  Date: 06/07/16 21:50:10

  Modified:    .        gattrib.c gtksheet_2_2.c s_object.c s_rename.c
                        s_sheet_data.c s_string_list.c s_table.c
                        s_toplevel.c x_dialog.c x_fileselect.c x_gtksheet.c
                        x_window.c
  Log:
  Changed all malloc/free calls to g_malloc/g_free.  Fixed improper freeing
  
  of pixmap as well.
  
  
  
  
  Revision  Changes    Path
  1.16      +1 -1      eda/geda/gaf/gattrib/src/gattrib.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: gattrib.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/gattrib.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -b -r1.15 -r1.16
  --- gattrib.c	3 Apr 2005 20:02:17 -0000	1.15
  +++ gattrib.c	17 Jul 2006 01:50:09 -0000	1.16
  @@ -257,7 +257,7 @@
       i++;
       g_free(filename);
     }  /* while(argv[i])  */
  -  free(cwd);
  +  g_free(cwd); /* cwd is allocated with g_strdup so, g_free is correct */
   
   
     /* ---------- Now complete read-in of project  ---------- */
  
  
  
  1.10      +1 -1      eda/geda/gaf/gattrib/src/gtksheet_2_2.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: gtksheet_2_2.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/gtksheet_2_2.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- gtksheet_2_2.c	3 Jun 2006 13:06:40 -0000	1.9
  +++ gtksheet_2_2.c	17 Jul 2006 01:50:09 -0000	1.10
  @@ -2833,7 +2833,7 @@
     gdk_window_destroy (sheet->row_title_window);
   
     if (sheet->pixmap){
  -    g_free (sheet->pixmap);
  +    g_object_unref (sheet->pixmap);
       sheet->pixmap = NULL;
     }
   
  
  
  
  1.7       +10 -10    eda/geda/gaf/gattrib/src/s_object.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_object.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_object.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- s_object.c	14 Jul 2005 17:29:24 -0000	1.6
  +++ s_object.c	17 Jul 2006 01:50:10 -0000	1.7
  @@ -155,19 +155,19 @@
         if (strcmp(old_attrib_name, new_attrib_name) == 0) {
   	/* create attrib=value text string & stuff it back into pr_current */
   	new_attrib_text = g_strconcat(new_attrib_name, "=", new_attrib_value, NULL);
  -	free(a_current->object->text->string);   /* remove old attrib string */
  +	g_free(a_current->object->text->string);   /* remove old attrib string */
   	a_current->object->text->string = g_strdup(new_attrib_text);   /* insert new attrib string */
   	if (visibility != LEAVE_VISIBILITY_ALONE) 
   	  a_current->object->visibility = visibility;
   	if (show_name_value != LEAVE_NAME_VALUE_ALONE)
   	  a_current->object->show_name_value = show_name_value; 
  -	free(new_attrib_text);
  -	free(old_attrib_text);
  -	free(old_attrib_name);
  +	g_free(new_attrib_text);
  +	g_free(old_attrib_text);
  +	g_free(old_attrib_name);
   	return;     /* we are done -- leave. */
         } else {
  -	free(old_attrib_text);
  -	free(old_attrib_name);
  +	g_free(old_attrib_text);
  +	g_free(old_attrib_name);
         }  /* if (strcmp . . . . */
       } /* if (a_current . . . . */
     
  @@ -213,12 +213,12 @@
   	attribute_object = a_current->object;
   	s_object_delete_text_object_in_object(pr_current, attribute_object);
   
  -	free(old_attrib_text);
  -	free(old_attrib_name);
  +	g_free(old_attrib_text);
  +	g_free(old_attrib_name);
   	return;     /* we are done -- leave. */
         }
  -    free(old_attrib_text);
  -    free(old_attrib_name);
  +    g_free(old_attrib_text);
  +    g_free(old_attrib_name);
       }
       a_current = a_current->next;
     }
  
  
  
  1.3       +8 -8      eda/geda/gaf/gattrib/src/s_rename.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_rename.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_rename.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- s_rename.c	5 Feb 2005 16:03:53 -0000	1.2
  +++ s_rename.c	17 Jul 2006 01:50:10 -0000	1.3
  @@ -81,12 +81,12 @@
   	for (j = 0; j < MAX_RENAME; j++) {
   
   	    if (rename_pairs[i][j].src) {
  -		free(rename_pairs[i][j].src);
  +		g_free(rename_pairs[i][j].src);
   		rename_pairs[i][j].src = NULL;
   	    }
   
   	    if (rename_pairs[i][j].dest) {
  -		free(rename_pairs[i][j].dest);
  +		g_free(rename_pairs[i][j].dest);
   		rename_pairs[i][j].dest = NULL;
   	    }
   	}
  @@ -183,10 +183,10 @@
   #endif
   
   		    rename_pairs[cur_set][rename_counter].src =
  -			(char *) malloc(sizeof(char) * (strlen(src) + 1));
  +			(char *) g_malloc(sizeof(char) * (strlen(src) + 1));
   		    strcpy(rename_pairs[cur_set][rename_counter].src, src);
   		    rename_pairs[cur_set][rename_counter].dest =
  -			(char *) malloc(sizeof(char) *
  +			(char *) g_malloc(sizeof(char) *
   					(strlen
   					 (rename_pairs[cur_set][i].dest) +
   					 1));
  @@ -199,10 +199,10 @@
       } else {
   
   	rename_pairs[cur_set][rename_counter].src =
  -	    (char *) malloc(sizeof(char) * (strlen(src) + 1));
  +	    (char *) g_malloc(sizeof(char) * (strlen(src) + 1));
   	strcpy(rename_pairs[cur_set][rename_counter].src, src);
   	rename_pairs[cur_set][rename_counter].dest =
  -	    (char *) malloc(sizeof(char) * (strlen(dest) + 1));
  +	    (char *) g_malloc(sizeof(char) * (strlen(dest) + 1));
   	strcpy(rename_pairs[cur_set][rename_counter].dest, dest);
   	rename_counter++;
       }
  @@ -233,10 +233,10 @@
   			/* this is a bad idea */
   			/* because inside nets-> */
   			/* there is another pointer */
  -			/*free(pl_current->net_name); */
  +			/*g_free(pl_current->net_name); */
   
   			pl_current->net_name =
  -			    malloc(sizeof(char) * (strlen(dest) + 1));
  +			    g_malloc(sizeof(char) * (strlen(dest) + 1));
   			strcpy(pl_current->net_name, dest);
   		    }
   		}
  
  
  
  1.10      +10 -10    eda/geda/gaf/gattrib/src/s_sheet_data.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_sheet_data.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_sheet_data.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- s_sheet_data.c	11 Mar 2005 17:50:56 -0000	1.9
  +++ s_sheet_data.c	17 Jul 2006 01:50:10 -0000	1.10
  @@ -54,7 +54,7 @@
   {
     SHEET_DATA *new_sheet;
   
  -  new_sheet = (SHEET_DATA *) malloc(sizeof(SHEET_DATA));
  +  new_sheet = (SHEET_DATA *) g_malloc(sizeof(SHEET_DATA));
   
     /* We will malloc and fill out the comp table later. */
     new_sheet->component_table = NULL;
  @@ -134,7 +134,7 @@
   	  printf("       In s_sheet_add_master_comp_list, about to add to master list refdes = %s\n", temp_uref);
   #endif
   	  s_string_list_add_item(sheet_head->master_comp_list_head, &(sheet_head->comp_count), temp_uref);
  -	  free(temp_uref);
  +	  g_free(temp_uref);
   	}
   	
         } /*  if (o_current->type == OBJ_COMPLEX . . . . .) */
  @@ -202,8 +202,8 @@
   	      s_string_list_add_item(sheet_head->master_comp_attrib_list_head, 
   				     &(sheet_head->comp_attrib_count), attrib_name);
   	    }   /* if (strcmp(attrib_name, "refdes") != 0) */ 
  -	    free(attrib_name);
  -	    free(attrib_text);
  +	    g_free(attrib_name);
  +	    g_free(attrib_text);
   	  }
   	  a_current = a_current->next;
   	}   /*  while  */
  @@ -304,7 +304,7 @@
   		fprintf(stderr, ". . . . refdes = %s.\n", temp_uref);
   #endif
   	      }
  -	      free(temp_pinnumber);
  +	      g_free(temp_pinnumber);
   	      
   	    }
   	    o_lower_current = o_lower_current->next;
  @@ -316,7 +316,7 @@
   	  fprintf(stderr, ". . . . complex_basename = %s.\n", o_current->complex_basename);
   #endif
   	}
  -	free(temp_uref);
  +	g_free(temp_uref);
   
         }  /*  if (o_current->type == OBJ_COMPLEX)  */
         o_current = o_current->next;  
  @@ -399,9 +399,9 @@
   		    s_string_list_add_item(sheet_head->master_pin_attrib_list_head, 
   					   &(sheet_head->pin_attrib_count), attrib_name);
   		  }   /* if (strcmp(attrib_name, "pinnumber") != 0) */ 
  -		  if (attrib_value != NULL) free(attrib_value);
  -		  free(attrib_name);
  -		  free(attrib_text);
  +		  if (attrib_value != NULL) g_free(attrib_value);
  +		  g_free(attrib_name);
  +		  g_free(attrib_text);
   		}
   		pin_attrib = pin_attrib->next;
   	      }   /*   while (pin_attrib != NULL)  */
  @@ -409,7 +409,7 @@
   	    o_lower_current = o_lower_current->next;
   	  }   /*  while (o_lower_current != NULL)   */
   
  -	  free(temp_uref);
  +	  g_free(temp_uref);
   	}  /*  if (temp_uref != NULL )  */
   	
         }  /* if (o_current->type == OBJ_COMPLEX)  */
  
  
  
  1.6       +11 -11    eda/geda/gaf/gattrib/src/s_string_list.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_string_list.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_string_list.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- s_string_list.c	13 Feb 2005 01:40:02 -0000	1.5
  +++ s_string_list.c	17 Jul 2006 01:50:10 -0000	1.6
  @@ -51,7 +51,7 @@
   STRING_LIST *s_string_list_new() {
     STRING_LIST *local_string_list;
     
  -  local_string_list = malloc(sizeof(STRING_LIST));
  +  local_string_list = g_malloc(sizeof(STRING_LIST));
     local_string_list->data = NULL;
     local_string_list->next = NULL;
     local_string_list->prev = NULL;
  @@ -81,7 +81,7 @@
     while (local_string_list != NULL) {
       data = g_strdup(local_string_list->data);
       s_string_list_add_item(new_string_list, &count, data);
  -    free(data);
  +    g_free(data);
       local_string_list = local_string_list->next;
     }
   
  @@ -132,10 +132,10 @@
       trial_item = (gchar *) g_strdup(list->data);        
       if (strcmp(trial_item, item) == 0) {
         /* Found item already in list.  Just return. */
  -      free(trial_item);
  +      g_free(trial_item);
         return;
       }
  -    free(trial_item);
  +    g_free(trial_item);
       prev = list;
       list = list->next;
     }
  @@ -143,7 +143,7 @@
     /* If we are here, it's 'cause we didn't find the item pre-existing in the list. */
     /* In this case, we insert it. */
   
  -  local_list = (STRING_LIST *) malloc(sizeof(STRING_LIST));  /* allocate space for this list entry */
  +  local_list = (STRING_LIST *) g_malloc(sizeof(STRING_LIST));  /* allocate space for this list entry */
     local_list->data = (gchar *) g_strdup(item);   /* copy data into list */
     local_list->next = NULL;
     local_list->prev = prev;  /* point this item to last entry in old list */
  @@ -204,7 +204,7 @@
   	/* at list's beginning */
   	next_item->prev = NULL;
   	(*list) = next_item;         /* also need to fix pointer to list head */
  -	/*  free(list);  */
  +	/*  g_free(list);  */
         } else {
   	/* normal case of element in middle of list */
   	prev_item->next = next_item;
  @@ -214,20 +214,20 @@
   #ifdef DEBUG
       printf("In s_string_list_delete_item, now free list_item\n");
   #endif
  -      free(list_item);  /* free current list item */
  +      g_free(list_item);  /* free current list item */
         (*count)--;       /* decrement count */
         /* Do we need to re-number the list? */
   
   #ifdef DEBUG
       printf("In s_string_list_delete_item, now free trial_item\n");
   #endif
  -      free(trial_item); /* free trial item before returning */
  +      g_free(trial_item); /* free trial item before returning */
   #ifdef DEBUG
       printf("In s_string_list_delete_item, returning . . . .\n");
   #endif
         return;
       }
  -    free(trial_item);
  +    g_free(trial_item);
       list_item = list_item->next;
     }
   
  @@ -260,10 +260,10 @@
       trial_item = (gchar *) g_strdup(list->data);        
       if (strcmp(trial_item, item) == 0) {
         /* Found item already in list.  return 1. */
  -      free(trial_item);
  +      g_free(trial_item);
         return 1;
       }
  -    free(trial_item);
  +    g_free(trial_item);
       list = list->next;
     }
   
  
  
  
  1.11      +28 -28    eda/geda/gaf/gattrib/src/s_table.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_table.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_table.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- s_table.c	14 Jul 2005 17:29:24 -0000	1.10
  +++ s_table.c	17 Jul 2006 01:50:10 -0000	1.11
  @@ -61,9 +61,9 @@
     int i, j;
   
     /* Here I am trying to create a 2 dimensional array of structs */
  -  new_table = (TABLE **) malloc(rows*sizeof(TABLE *));
  +  new_table = (TABLE **) g_malloc(rows*sizeof(TABLE *));
     for (i = 0; i < rows; i++) {
  -    new_table[i] = (TABLE *) malloc(cols * sizeof(TABLE));
  +    new_table[i] = (TABLE *) g_malloc(cols * sizeof(TABLE));
       /* Note that I should put some checks in here to verify that 
        * malloc worked correctly. */
     }
  @@ -97,9 +97,9 @@
     s_table_destroy(**table, old_rows, old_cols);
   
     /* Here I am trying to create a 2 dimensional array of structs */
  -  new_table = (TABLE **) malloc(new_rows*sizeof(TABLE *));
  +  new_table = (TABLE **) g_malloc(new_rows*sizeof(TABLE *));
     for (i = 0; i < new_rows; i++) {
  -    new_table[i] = (TABLE *) malloc(new_cols * sizeof(TABLE));
  +    new_table[i] = (TABLE *) g_malloc(new_cols * sizeof(TABLE));
       /* Note that I should put some checks in here to verify that 
        * malloc worked correctly. */
     }
  @@ -137,19 +137,19 @@
     for (i = 0; i < row_count; i++) {
       for (j = 0; j < col_count; j++) {
         if ( (table[i][j]).attrib_value != NULL)
  -	free( (table[i][j]).attrib_value );
  +	g_free( (table[i][j]).attrib_value );
         if ( (table[i][j]).row_name != NULL)
  -	free( (table[i][j]).row_name );
  +	g_free( (table[i][j]).row_name );
         if ( (table[i][j]).col_name != NULL)
  -	free( (table[i][j]).col_name );
  +	g_free( (table[i][j]).col_name );
       }
     }
   
     for (i = 0; i < row_count; i++) {
  -    free( table[i] );
  +    g_free( table[i] );
     }
   
  -  free(table);
  +  g_free(table);
     table = NULL;
   
     return;
  @@ -211,7 +211,7 @@
         attrib_value = (table[row][col]).attrib_value;
         name_value_pair = g_strconcat(attrib_name, "=", attrib_value, NULL);
         s_string_list_add_item(attrib_pair_list, &count, name_value_pair);
  -      free(name_value_pair);
  +      g_free(name_value_pair);
       }
     }
   
  @@ -304,14 +304,14 @@
                 ((sheet_head->component_table)[row][col]).visibility = old_visibility;
                 ((sheet_head->component_table)[row][col]).show_name_value = old_show_name_value;
               }
  -            free(attrib_name);
  -            free(attrib_text);
  -            free(attrib_value);
  +            g_free(attrib_name);
  +            g_free(attrib_text);
  +            g_free(attrib_value);
             }
             a_current = a_current->next;
              
           }  /* while (a_current != NULL) */
  -        free(temp_uref);
  +        g_free(temp_uref);
         }  /* if (temp_uref) */
       }    /* if (o_current->type == OBJ_COMPLEX)  */
    
  @@ -380,14 +380,14 @@
               ((sheet_head->net_table)[row][col]).col_name = g_strdup(attrib_name);
               ((sheet_head->net_table)[row][col]).attrib_value = g_strdup(attrib_value);
             }
  -          free(attrib_name);
  -          free(attrib_text);
  -          free(attrib_value);
  +          g_free(attrib_name);
  +          g_free(attrib_text);
  +          g_free(attrib_value);
           }
           a_current = a_current->next;
    
         }  /* while (a_current != NULL) */
  -      free(temp_netname);
  +      g_free(temp_netname);
    
       }    /*--- if (o_current->type == OBJ_NET)   ---*/
          
  @@ -491,22 +491,22 @@
   		  ((sheet_head->pin_table)[row][col]).col_name = g_strdup(attrib_name);
   		  ((sheet_head->pin_table)[row][col]).attrib_value = g_strdup(attrib_value);
   		}
  -		free(attrib_name);
  -		free(attrib_text);
  -		free(attrib_value);
  +		g_free(attrib_name);
  +		g_free(attrib_text);
  +		g_free(attrib_value);
   	      }
   	      pin_attrib = pin_attrib->next;
              
   	    }  /* while (pin_attrib != NULL) */
  -	    free(pinnumber);
  -	    free(row_label);
  +	    g_free(pinnumber);
  +	    g_free(row_label);
   	  }
   
   	  o_lower_current = o_lower_current->next;
   	}    /*  while (o_lower_current != NULL)  */
         }
   
  -      free(temp_uref);
  +      g_free(temp_uref);
       }
   
       o_current = o_current->next;  /* iterate to next object on page */
  @@ -617,7 +617,7 @@
   
   #if 0
         if (strlen(attrib_value) == 0) {
  -	/* free(attrib_value);  */   /* sometimes we have spurious, zero length strings creep */
  +	/* g_free(attrib_value);  */   /* sometimes we have spurious, zero length strings creep */
   	attrib_value = NULL;    /* into the GtkSheet                                     */
         }
   #endif
  @@ -630,7 +630,7 @@
   
         /* first handle attrib value in cell */
         if ( local_table[row][col].attrib_value != NULL) {
  -	free( local_table[row][col].attrib_value );
  +	g_free( local_table[row][col].attrib_value );
         }
         if (attrib_value != NULL) {
   	local_table[row][col].attrib_value = (gchar *) g_strdup(attrib_value);
  @@ -640,7 +640,7 @@
   
         /* next handle name of row (also held in TABLE cell) */
         if ( local_table[row][col].row_name != NULL) {
  -	free( local_table[row][col].row_name );
  +	g_free( local_table[row][col].row_name );
         }
         if (row_title != NULL) {
   	local_table[row][col].row_name = (gchar *) g_strdup(row_title);
  @@ -650,7 +650,7 @@
   
         /* finally handle name of col */
         if ( local_table[row][col].col_name != NULL) {
  -	free( local_table[row][col].col_name );
  +	g_free( local_table[row][col].col_name );
         }
         if (col_title != NULL) {
   	local_table[row][col].col_name = (gchar *) g_strdup(col_title);
  
  
  
  1.14      +21 -21    eda/geda/gaf/gattrib/src/s_toplevel.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_toplevel.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_toplevel.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- s_toplevel.c	14 Jul 2005 17:29:24 -0000	1.13
  +++ s_toplevel.c	17 Jul 2006 01:50:10 -0000	1.14
  @@ -389,7 +389,7 @@
   			      &(sheet_head->comp_attrib_count), 
   			      attrib_name);
       s_string_list_sort_master_comp_attrib_list(); /* this renumbers list also */
  -    free(attrib_name);
  +    g_free(attrib_name);
       
   #ifdef DEBUG
       printf("In s_toplevel_delete_attrib_col, just updated comp_attrib string list.\n");
  @@ -515,7 +515,7 @@
   	s_toplevel_update_component_attribs_in_toplevel(o_current, 
   							new_comp_attrib_pair_list);
   
  -	free(temp_uref);
  +	g_free(temp_uref);
         } else {
   #ifdef DEBUG
   	printf("In s_toplevel_sheetdata_to_toplevel, found complex with no refdes. name = %s\n", 
  @@ -569,7 +569,7 @@
   	}    
         }     /* if(temp_uref  */
         
  -      free(temp_uref);
  +      g_free(temp_uref);
       }
       
       o_current = o_current->next;
  @@ -623,13 +623,13 @@
       if ( ((sheet_head->component_table)[row][i]).attrib_value ) {
         new_attrib_value = g_strdup( ((sheet_head->component_table)[row][i]).attrib_value );
         name_value_pair = g_strconcat(new_attrib_name, "=", new_attrib_value, NULL);
  -      free(new_attrib_value);      
  +      g_free(new_attrib_value);      
       } else {
         name_value_pair = g_strconcat(new_attrib_name, "=", NULL);  /* empty attrib */
       }
       s_string_list_add_item(new_attrib_list, &count, name_value_pair);  /* add name=value to new list */
  -    free(new_attrib_name);
  -    free(name_value_pair);
  +    g_free(new_attrib_name);
  +    g_free(name_value_pair);
   
       /* Sanity check */
       if (count != i+1) {
  @@ -718,8 +718,8 @@
   	   (s_attrib_name_in_list(new_comp_attrib_list, old_attrib_name) == FALSE) ) {
   	s_string_list_add_item(complete_comp_attrib_list, &count, old_name_value_pair);
         }
  -      free(old_name_value_pair);
  -      free(old_attrib_name);
  +      g_free(old_name_value_pair);
  +      g_free(old_attrib_name);
       }
       a_current = a_current->next;
     }  /* while (a_current != NULL) */
  @@ -778,7 +778,7 @@
     col = s_table_get_index(sheet_head->master_comp_attrib_list_head, new_attrib_name);
     visibility = sheet_head->component_table[row][col].visibility;
     show_name_value = sheet_head->component_table[row][col].show_name_value;
  -  free(refdes);
  +  g_free(refdes);
   
   
       /* -------  Four cases to consider: Case 1 ----- */
  @@ -833,16 +833,16 @@
   
       /* free everything and iterate */
       if (new_attrib_name != NULL) {
  -      free(new_attrib_name);  /* Be careful, this can be NULL */
  +      g_free(new_attrib_name);  /* Be careful, this can be NULL */
       }
       if (new_attrib_value != NULL) {
  -      free(new_attrib_value);  /* Be careful, this can be NULL */
  +      g_free(new_attrib_value);  /* Be careful, this can be NULL */
       }
       if (old_attrib_name != NULL) {
  -      free(old_attrib_name);  /* Be careful, this can be NULL */
  +      g_free(old_attrib_name);  /* Be careful, this can be NULL */
       }
       if (old_attrib_value != NULL) {
  -      free(old_attrib_value);  /* Be careful, this can be NULL */
  +      g_free(old_attrib_value);  /* Be careful, this can be NULL */
       }
       local_list = local_list->next;
     }   /*   while (local_list != NULL)  */
  @@ -933,13 +933,13 @@
       if ( ((sheet_head->pin_table)[row][i]).attrib_value ) {
         new_attrib_value = g_strdup( ((sheet_head->pin_table)[row][i]).attrib_value );
         name_value_pair = g_strconcat(new_attrib_name, "=", new_attrib_value, NULL);
  -      free(new_attrib_value);      
  +      g_free(new_attrib_value);      
       } else {
         name_value_pair = g_strconcat(new_attrib_name, "=", NULL);  /* empty attrib */
       }
       s_string_list_add_item(new_attrib_list, &count, name_value_pair);  /* add name=value to new list */
  -    free(new_attrib_name);
  -    free(name_value_pair);
  +    g_free(new_attrib_name);
  +    g_free(name_value_pair);
   
       /* Sanity check */
       if (count != i+1) {
  @@ -996,7 +996,7 @@
       new_attrib_name = u_basic_breakup_string(new_name_value_pair, '=', 0);
       new_attrib_value = u_basic_breakup_string(new_name_value_pair, '=', 1);
       if (strlen(new_attrib_value) == 0) {
  -      free(new_attrib_value);   /* I wonder if I should check for non-NULL first?  */
  +      g_free(new_attrib_value);   /* I wonder if I should check for non-NULL first?  */
         new_attrib_value = NULL;  /* u_basic_breakup_string doesn't return NULL for empty substring. */
       }
       old_attrib_value = o_attrib_search_name_single_count(o_pin, new_attrib_name, 0);
  @@ -1045,13 +1045,13 @@
       }
                                                                                                          
       /* free everything and iterate */
  -    free(new_name_value_pair);
  -    free(new_attrib_name);
  +    g_free(new_name_value_pair);
  +    g_free(new_attrib_name);
       if (new_attrib_value != NULL) {
  -      free(new_attrib_value);  /* Be careful, this can be NULL */
  +      g_free(new_attrib_value);  /* Be careful, this can be NULL */
       }
       if (old_attrib_value != NULL) {
  -      free(old_attrib_value);  /* Be careful, this can be NULL */
  +      g_free(old_attrib_value);  /* Be careful, this can be NULL */
       }
       local_list = local_list->next;
     }   /*   while (local_list != NULL)  */
  
  
  
  1.18      +7 -7      eda/geda/gaf/gattrib/src/x_dialog.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_dialog.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/x_dialog.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -b -r1.17 -r1.18
  --- x_dialog.c	6 Mar 2005 19:17:26 -0000	1.17
  +++ x_dialog.c	17 Jul 2006 01:50:10 -0000	1.18
  @@ -212,7 +212,7 @@
       printf("In x_dialog_newattrib_ok_callback, about to add new attrib = %s\n", entry_text);
   #endif
       s_toplevel_add_new_attrib(entry_text);
  -    free(entry_text);
  +    g_free(entry_text);
     }
   
     x_dialog_close_window(window);
  @@ -730,7 +730,7 @@
     /* Now create text string to place in vbox area */
     string = g_strdup_printf("Unimplemented Feature!\n\n");
     label = gtk_label_new(string);
  -  free(string);
  +  g_free(string);
     gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);
     gtk_widget_show(label);
     
  @@ -750,7 +750,7 @@
   
   
     label = gtk_label_new(string);
  -  free(string);
  +  g_free(string);
     gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);
     gtk_widget_show(label);
     
  @@ -842,19 +842,19 @@
     /* Now create text string to place in vbox area */
     string = g_strdup_printf("gEDA : GPL Electronic Design Automation");
     label = gtk_label_new(string);
  -  free(string);
  +  g_free(string);
     gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);
     gtk_widget_show(label);
     
     string = g_strdup_printf("This is gattrib -- gEDA's attribute editor");
     label = gtk_label_new(string);
  -  free(string);
  +  g_free(string);
     gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);
     gtk_widget_show(label);
     
     string = g_strdup_printf("Gattrib version: %s", VERSION);
     label = gtk_label_new(string);
  -  free(string);
  +  g_free(string);
     gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);
     gtk_widget_show(label);
     
  @@ -866,7 +866,7 @@
     string =
       g_strdup_printf("%sand gtkextra, as well as support from the gEDA community.", string);
     label = gtk_label_new(string);
  -  free(string);
  +  g_free(string);
     gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);
     gtk_widget_show(label);
     
  
  
  
  1.10      +31 -31    eda/geda/gaf/gattrib/src/x_fileselect.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_fileselect.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/x_fileselect.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- x_fileselect.c	21 Feb 2005 05:29:33 -0000	1.9
  +++ x_fileselect.c	17 Jul 2006 01:50:10 -0000	1.10
  @@ -105,19 +105,19 @@
     x_fileselect_free_list_buffers(f_current);
   
     if (f_current->directory) {
  -    free(f_current->directory);
  +    g_free(f_current->directory);
       f_current->directory = NULL;
     }
   
     if (f_current->filename) {
  -    free(f_current->filename);
  +    g_free(f_current->filename);
       f_current->filename = NULL;
     }
   
     gtk_grab_remove(f_current->xfwindow);
     f_current->toplevel = NULL;
     f_current->xfwindow = NULL;
  -  free(f_current);   
  +  g_free(f_current);   
     /* *window = NULL; */
     return;
   }
  @@ -167,14 +167,14 @@
   
     for (i = MAX_FILES; i >= 0; i--) {
       if (f_current->file_entries[i])
  -      free(f_current->file_entries[i]);
  +      g_free(f_current->file_entries[i]);
   
       f_current->file_entries[i] = NULL;
     }
   
     for (i = MAX_DIRS; i >= 0; i--) {
       if (f_current->directory_entries[i])
  -      free(f_current->directory_entries[i]);
  +      g_free(f_current->directory_entries[i]);
   
       f_current->directory_entries[i] = NULL;
     }
  @@ -192,12 +192,12 @@
     char *temp = NULL;
   
     if (f_current->filename) {
  -    free(f_current->filename);
  +    g_free(f_current->filename);
       f_current->filename = NULL;
     }
   
     if (f_current->directory) {
  -    free(f_current->directory);
  +    g_free(f_current->directory);
       f_current->directory = NULL;
     }
   
  @@ -208,7 +208,7 @@
       f_current->directory = g_strdup(temp);
       f_current->filename = g_strdup(filename);
   
  -    free(temp);
  +    g_free(temp);
   #ifdef __MINGW32__
       if (u_basic_has_trailing(f_current->directory, G_DIR_SEPARATOR)) {
         temp = g_strconcat(f_current->directory,
  @@ -228,7 +228,7 @@
       f_current->directory = g_strdup(temp);
   
       if (f_current->filename) {
  -      free(f_current->filename);
  +      g_free(f_current->filename);
         f_current->filename = NULL;
       }
   
  @@ -236,7 +236,7 @@
   		       f_current->directory);
     }
   
  -  free(temp);
  +  g_free(temp);
   
   #if DEBUG
     printf("In x_fileselect_update_dirfile, directory: %s\n", f_current->directory);
  @@ -257,14 +257,14 @@
   
     for (i = num_files+1; i >= 0; i--) {
       if (f_current->file_entries[i]) {
  -      free(f_current->file_entries[i]);
  +      g_free(f_current->file_entries[i]);
       }
       f_current->file_entries[i] = NULL;
     }
   
     for (i = num_directories+1; i >= 0; i--) {
       if (f_current->directory_entries[i]) {
  -      free(f_current->directory_entries[i]);
  +      g_free(f_current->directory_entries[i]);
       }
       f_current->directory_entries[i] = NULL;
     }
  @@ -398,7 +398,7 @@
   	(strcmp(dirent_ptr->d_name, ".") != 0)) {
   
         f_current->directory_entries[dir_count] = (char *)
  -	  malloc(sizeof(char) * (strlen(dirent_ptr->d_name) + 2));
  +	  g_malloc(sizeof(char) * (strlen(dirent_ptr->d_name) + 2));
   
         sprintf(f_current->directory_entries[dir_count],
   	      "%s", dirent_ptr->d_name);
  @@ -408,7 +408,7 @@
         if (x_fileselect_include_file(dirent_ptr->d_name,
   				    f_current->filter_type)) {
   	f_current->file_entries[file_count] = (char *)
  -	    malloc(sizeof(char) * (strlen(dirent_ptr->d_name) + 1));
  +	    g_malloc(sizeof(char) * (strlen(dirent_ptr->d_name) + 1));
   	strcpy(f_current->file_entries[file_count], dirent_ptr->d_name);
   	file_count++;
         }
  @@ -486,7 +486,7 @@
         max_width = width;
       }
   
  -    free(temp);
  +    g_free(temp);
   #if DEBUG
       printf("In x_fileselect_fill_lists, directory: %s\n", f_current->directory_entries[i]);
   #endif
  @@ -563,7 +563,7 @@
   
     buf = g_strdup_printf("sch - Schematics");
     menuitem = gtk_radio_menu_item_new_with_label(group, buf);
  -  free(buf);
  +  g_free(buf);
     group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menuitem));
     gtk_menu_append(GTK_MENU(menu), menuitem);
     gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
  @@ -572,7 +572,7 @@
   
     buf = g_strdup_printf("* - All Files");
     menuitem = gtk_radio_menu_item_new_with_label(group, buf);
  -  free(buf);
  +  g_free(buf);
     group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menuitem));
     gtk_menu_append(GTK_MENU(menu), menuitem);
     gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
  @@ -659,7 +659,7 @@
   
     if (string[len - 1] != G_DIR_SEPARATOR) {
       if (w_current->page_current->page_filename) {
  -      free(w_current->page_current->page_filename);
  +      g_free(w_current->page_current->page_filename);
       }
   
       w_current->page_current->page_filename = g_strdup(string);
  @@ -803,9 +803,9 @@
   			 &filename);
   
         /* allocate space, then stick full, absolute filename into string */
  -      string = malloc(strlen(f_current->directory) + strlen(filename) + 2);
  +      string = g_malloc(strlen(f_current->directory) + strlen(filename) + 2);
         if (!string) {		/* sanity check . . . */
  -	/* free(string); freeing a null pointer is bad. */
  +	/* g_free(string); freeing a null pointer is bad. */
   	return;
         }
         /* string is full name of file. */
  @@ -829,7 +829,7 @@
         } else {
   	return_code |= s_toplevel_read_page(string);
         }
  -      free(string);
  +      g_free(string);
         
         /* Now add all items found to the master lists */
         s_sheet_data_add_master_comp_list_items(pr_current->page_current->object_head); 
  @@ -1033,18 +1033,18 @@
     }
   
     if (f_current->filename) {
  -    free(f_current->filename);
  +    g_free(f_current->filename);
       f_current->filename = NULL;
     }
   
     if (f_current->directory) {
  -    free(f_current->directory);
  +    g_free(f_current->directory);
       f_current->directory = NULL;
     }
   
   #if 0
  -  directory = (char *) malloc(sizeof(char) * (strlen(new_filename) + 1));
  -  filename = (char *) malloc(sizeof(char) * (strlen(new_filename) + 1));
  +  directory = (char *) g_malloc(sizeof(char) * (strlen(new_filename) + 1));
  +  filename = (char *) g_malloc(sizeof(char) * (strlen(new_filename) + 1));
   
     ptr = new_filename;
     temp = strrchr(new_filename, G_DIR_SEPARATOR);
  @@ -1081,12 +1081,12 @@
   
     if (directory) {
       f_current->directory = g_strdup(directory);
  -    free(directory);
  +    g_free(directory);
     }
   
     if (filename) {
       f_current->filename = g_strdup(filename);
  -    free(filename);
  +    g_free(filename);
     }
   #ifdef __MINGW32__
     if (u_basic_has_trailing(f_current->directory, G_DIR_SEPARATOR)) {
  @@ -1102,7 +1102,7 @@
   #endif
     gtk_entry_set_text(GTK_ENTRY(f_current->filename_entry), temp);
   
  -  free(temp);
  +  g_free(temp);
   
   #if DEBUG
     printf("In x_fileselect_update_dirfile_saveas, f_current->directory = %s\n", f_current->directory);
  @@ -1181,7 +1181,7 @@
     /* Initialize filedialog object.  This object holds pointers
      * to all information in filedialog window, including pointers
      * to several widgets in the window. */
  -  f_current = malloc(sizeof(FILEDIALOG));
  +  f_current = g_malloc(sizeof(FILEDIALOG));
     /* (pr_current->fileselect)[0] = f_current; */ /* Keep a pointer to the file dialog in TOPLEVEL */
   
     f_current->xfwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  @@ -1312,7 +1312,7 @@
   
     gtk_widget_show(f_current->dir_list);
     gtk_widget_show(scrolled_win);
  -  free(dir_title[0]);
  +  g_free(dir_title[0]);
     
     /*  ----- Create the files clist -----  */
     file_title[0] = g_strdup("Files");
  @@ -1345,7 +1345,7 @@
   
     gtk_widget_show(f_current->file_list);
     gtk_widget_show(scrolled_win);
  -  free(file_title[0]);
  +  g_free(file_title[0]);
     
     /*  ----- Create the "Filename" text entry area -----  */
     label = gtk_label_new("Filename");
  
  
  
  1.9       +4 -4      eda/geda/gaf/gattrib/src/x_gtksheet.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_gtksheet.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/x_gtksheet.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- x_gtksheet.c	11 Mar 2005 17:50:56 -0000	1.8
  +++ x_gtksheet.c	17 Jul 2006 01:50:10 -0000	1.9
  @@ -84,7 +84,7 @@
   
   #ifndef HAS_GTK22
     GtkSheetRange *Range;
  -  Range = malloc(sizeof(GtkSheetRange));
  +  Range = g_malloc(sizeof(GtkSheetRange));
   #endif
   
     /* ---  Create three new sheets.   were malloc'ed in x_window_init  --- */
  @@ -185,7 +185,7 @@
   
   #ifndef HAS_GTK22
     /*  Don't need this anymore  */
  -  free(Range);
  +  g_free(Range);
   #endif
   
   
  @@ -285,7 +285,7 @@
       
       gtk_sheet_row_button_add_label(sheet, j, text);
       gtk_sheet_row_button_justify(sheet, j, GTK_JUSTIFY_LEFT);
  -    free(text);
  +    g_free(text);
       string_list_item = string_list_item->next;
     }
   
  @@ -315,7 +315,7 @@
       gtk_sheet_column_button_add_label(sheet, j, text);
       gtk_sheet_column_button_justify(sheet, j, GTK_JUSTIFY_LEFT);
       /* need to resize the column width here . . . */
  -    free(text);
  +    g_free(text);
       string_list_item = string_list_item->next;
     }
     return;
  
  
  
  1.8       +4 -4      eda/geda/gaf/gattrib/src/x_window.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_window.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/x_window.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- x_window.c	14 Jul 2005 17:29:24 -0000	1.7
  +++ x_window.c	17 Jul 2006 01:50:10 -0000	1.8
  @@ -162,7 +162,7 @@
     printf("In x_window_init, about to malloc space for sheets.\n");
   #endif
     for(i=0; i<NUM_SHEETS; i++){
  -    sheets=(GtkSheet **)realloc(sheets, (i+1)*sizeof(GtkWidget *));
  +    sheets=(GtkSheet **) g_realloc(sheets, (i+1)*sizeof(GtkWidget *));
     }
   
     /* -----  Finally show top level window to make everything appear  ----- */
  @@ -309,7 +309,7 @@
         if ( (sheet_head->component_table)[i][j].attrib_value ) { /* NULL = no entry */
   	text = (gchar *) g_strdup( (sheet_head->component_table)[i][j].attrib_value );
   	x_gtksheet_add_cell_item( GTK_SHEET(sheets[0]), i, j, (gchar *) text );
  -	free(text);
  +	g_free(text);
         }
       }
     }
  @@ -328,7 +328,7 @@
         if ( (sheet_head->net_table)[i][j].attrib_value ) { /* NULL = no entry */
   	text = (gchar *) g_strdup( (sheet_head->net_table)[i][j].attrib_value );
   	x_gtksheet_add_cell_item( GTK_SHEET(sheets[1]), i, j, (gchar *) text );
  -	free(text);
  +	g_free(text);
         }
       }
     }
  @@ -349,7 +349,7 @@
         if ( (sheet_head->pin_table)[i][j].attrib_value ) { /* NULL = no entry */
   	text = (gchar *) g_strdup( (sheet_head->pin_table)[i][j].attrib_value );
   	x_gtksheet_add_cell_item( GTK_SHEET(sheets[2]), i, j, (gchar *) text );
  -	free(text);
  +	g_free(text);
         }
       }
     }
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs