all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Problem report #56
@ 2006-04-10 19:02 Dan Nicolaescu
  2006-04-10 20:07 ` Stuart D. Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Nicolaescu @ 2006-04-10 19:02 UTC (permalink / raw)



CID: 56
Checker: UNINIT (help)
File: emacs/src/window.c
Function: size_window
Description: Using uninitialized value "extra"

Event var_decl: Declared variable "extra" without initializer
Also see events: [uninit_use]

2906 	      int fixed_size, each, extra, n;
2907 	      int resize_fixed_p, nfixed;
2908 	      int last_pos, first_pos, nchildren, total;
2909 	      int *new_sizes = NULL;
2910 	
2911 	      /* Determine the fixed-size portion of the this window, and the
2912 		 number of child windows.  */
2913 	      fixed_size = nchildren = nfixed = total = 0;

At conditional (1): "child != Qnil" taking true path
At conditional (4): "child != Qnil" taking true path
At conditional (7): "child != Qnil" taking true path
At conditional (10): "child != Qnil" taking false path

2914 	      for (child = *forward; !NILP (child); child = c->next, ++nchildren)
2915 		{
2916 		  int child_size;
2917 	
2918 		  c = XWINDOW (child);

At conditional (2): "width_p != 0" taking true path
At conditional (5): "width_p != 0" taking true path
At conditional (8): "width_p != 0" taking true path

2919 		  child_size = width_p ? XINT (c->total_cols) : XINT (c->total_lines);
2920 		  total += child_size;
2921 	

At conditional (3): "window_fixed_size_p != 0" taking false path
At conditional (6): "window_fixed_size_p != 0" taking false path
At conditional (9): "window_fixed_size_p != 0" taking false path

2922 		  if (window_fixed_size_p (c, width_p, 0))
2923 		    {
2924 		      fixed_size += child_size;
2925 		      ++nfixed;
2926 		    }
2927 		}
2928 	
2929 	      /* If the new size is smaller than fixed_size, or if there
2930 		 aren't any resizable windows, allow resizing fixed-size
2931 		 windows.  */

At conditional (11): "nfixed == nchildren" taking true path

2932 	      resize_fixed_p = nfixed == nchildren || size < fixed_size;
2933 	
2934 	      /* Compute how many lines/columns to add/remove to each child.  The
2935 		 value of extra takes care of rounding errors.  */

At conditional (12): "resize_fixed_p != 0" taking true path

2936 	      n = resize_fixed_p ? nchildren : nchildren - nfixed;

At conditional (13): "size < total" taking true path
At conditional (14): "n > 1" taking true path

2937 	      if (size < total && n > 1)
2938 	        new_sizes = shrink_windows (total, size, nchildren, n, min_size,
2939 	                                    resize_fixed_p, *forward, width_p);
2940 	      else
2941 	        {
2942 	          each = (size - total) / n;
2943 	          extra = (size - total) - n * each;
2944 	        }
2945 	
2946 	      /* Compute new children heights and edge positions.  */

At conditional (15): "width_p != 0" taking true path

2947 	      first_pos = width_p ? XINT (w->left_col) : XINT (w->top_line);
2948 	      last_pos = first_pos;

At conditional (16): "child != Qnil" taking true path

2949 	      for (n = 0, child = *forward; !NILP (child); child = c->next, ++n)
2950 		{
2951 		  int new_size, old_size;
2952 	
2953 		  c = XWINDOW (child);

At conditional (17): "width_p != 0" taking true path

2954 		  old_size = width_p ? XFASTINT (c->total_cols) : XFASTINT (c->total_lines);
2955 		  new_size = old_size;
2956 	
2957 		  /* The top or left edge position of this child equals the
2958 		     bottom or right edge of its predecessor.  */

At conditional (18): "width_p != 0" taking true path

2959 		  if (width_p)
2960 		    c->left_col = make_number (last_pos);
2961 		  else
2962 		    c->top_line = make_number (last_pos);
2963 	
2964 		  /* If this child can be resized, do it.  */

At conditional (19): "resize_fixed_p != 0" taking true path

2965 		  if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0))
2966 		    {

Event uninit_use: Using uninitialized value "extra"
Also see events: [var_decl]
At conditional (20): "new_sizes != 0" taking false path

2967 		      new_size = new_sizes ? new_sizes[n] : old_size + each + extra;
2968 		      extra = 0;
2969 		    }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problem report #56
  2006-04-10 19:02 Problem report #56 Dan Nicolaescu
@ 2006-04-10 20:07 ` Stuart D. Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Stuart D. Herring @ 2006-04-10 20:07 UTC (permalink / raw)


> 2937 	      if (size < total && n > 1)
> 2938 	        new_sizes = shrink_windows (total, size, nchildren, n,
> min_size,
> 2939 	                                    resize_fixed_p, *forward,
> width_p);
> 2940 	      else
> 2941 	        {
> 2942 	          each = (size - total) / n;
> 2943 	          extra = (size - total) - n * each;
> 2944 	        }

If extra is not assigned here, then new_sizes is.  (I assume that
shrink_windows() never returns NULL.)

> 2967 		      new_size = new_sizes ? new_sizes[n] : old_size + each +
> extra;

...So this is harmless: if we use extra, new_sizes is NULL, so we didn't
assign it, so we assigned extra.  No bug.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-10 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-10 19:02 Problem report #56 Dan Nicolaescu
2006-04-10 20:07 ` Stuart D. Herring

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.