Ticket #151 (closed defect: fixed)
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
Change History
Changed 16 years ago by winnie
- Attachment fix_uninitalised_int.patch added
Small patch which rewrites the return logic
comment:2 Changed 16 years ago by winnie
- Owner set to winnie
- Keywords review added
- Status changed from new to accepted
I've added a small patch which should fix this warning
Please review.
comment:4 Changed 16 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 ;)
comment:5 Changed 16 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.
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).