Ticket #151 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

Unitialized use of variable in edit.c

Reported by: metux Owned by: winnie
Priority: minor Milestone: 4.6.2
Component: mc-core Version: 4.6.1
Keywords: committed-mc-4.6 Cc:
Blocked By: Blocking:
Branch state: Votes for changeset:

Description

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -Wall -MT edit.o -MD -MP -MF .deps/edit.Tpo -c -o edit.o edit.c
edit.c: In function 'edit_cursor_move':
edit.c:1102: warning: 'c' may be used uninitialized in this function
mv -f .deps/edit.Tpo .deps/edit.Po

Attachments

fix_uninitalised_int.patch (855 bytes) - added by winnie 8 years ago.
Small patch which rewrites the return logic
fix_uninitalised_int-rev2.patch (1.9 KB) - added by slavazanko 8 years ago.

Change History

comment:1 Changed 8 years ago by winnie

  • Priority changed from major to minor

I think this is uncritical as c will get in every case initialised. However if you would like to get rid of this warning initialise c to -3. As this is the default return value for this function.

If you do this you could rewrite it partly in order to replace the four return calls with only one. (After the if clause).

Changed 8 years ago by winnie

Small patch which rewrites the return logic

comment:2 Changed 8 years ago by winnie

  • Status changed from new to accepted
  • Owner set to winnie
  • Keywords review added

I've added a small patch which should fix this warning

Please review.

comment:3 Changed 8 years ago by metux

  • Keywords review,vote-metux added; review removed

comment:4 Changed 8 years ago by slavazanko

  • Keywords review added; review,vote-metux removed

I run 'grep' over sources for search calls of edit_cursor_move() function.

And not any case to checking return value of this function. As fact, this function will must non-return type ( void ).

See patch fix_uninitalised_int-rev2.patch.

Patch don't applyed to branch - I think that the rules of good manners: branch must change by developer, who created the branch. The rest (all those involved in the ticket, not just developers) is temporarily becoming subordinates, developer (branch-starter) is temporarily becoming team leader. If this idea good - need to update workflow ;)

Changed 8 years ago by slavazanko

comment:5 Changed 8 years ago by winnie

  • Keywords vote-winnie added

As we are really doesn't use the returncode of this function it's okay to remove it and make it a void function.

comment:6 Changed 8 years ago by metux

  • Keywords approved vote-metux added; review removed

comment:7 Changed 8 years ago by winnie

  • Keywords committed-mc-4.6 added; approved vote-winnie vote-metux removed
  • Status changed from accepted to testing
  • Resolution set to fixed

This is now merged to mc-4.6 and master.

comment:8 Changed 8 years ago by winnie

  • Status changed from testing to closed

Closing

Note: See TracTickets for help on using tickets.