Menu
Logged-In As
ACCOUNTNot Logged In
Reduce duplicate code in htonf.cBRL-CAD
Status: ClosedTime to complete:
48 hrs
Mentors: Sean, Andrei Popescu
BRL-CAD is more than one million lines of source code and keeping that much code clean is a never-ending task. Keeping maintenance costs low requires consistent attention on improving code quality. One great way to improve code quality is to reduce the amount of duplication.
This task involves creating a static inline function named convert_float(). Since you will modify an existing file, you need to write the function in C. It should have the same functionality as the duplicated code in our htonf() and ntonf() functions.
References:
- http://www.greenend.org.uk/rjk/tech/inline.html - About inline functions.
Code:
- brlcad/src/libbu/htonf.c
Contact andrei on #brlcad on irc.freenode.net if you need help on this task.
Uploaded Work
File name/URL | File size | Date submitted | |
---|---|---|---|
htonf.c | 2.3 KB | December 03 2012 13:19 UTC | |
htonf.patch | 2.4 KB | December 03 2012 17:20 UTC | |
htonf_2.patch | 2.4 KB | December 03 2012 17:24 UTC | |
htonf_3.diff | 2.5 KB | December 03 2012 22:07 UTC | |
htonf4.patch | 3.3 KB | December 04 2012 13:18 UTC | |
htonf_5.patch | 1.7 KB | December 05 2012 16:29 UTC |
I would like to work on this task.
This task has been assigned to Shomiron Ghose. You have 48 hours to complete this task, good luck!
The work on this task is ready to be reviewed.
I am 40% sure that is right. please check. if not i'll redo it.
- provide a patch file
- see "1) Indentation whitespace" in Hacking for the right indentation
- use HIDDEN instead of inline
- you don't need to provide an extra prototype if the definition precedes the usage
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The work on this task is ready to be reviewed.
Issues have been discussed on IRC.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The work on this task is ready to be reviewed.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
Thanks for your efforts but the latest patch still has style conformancy problems. See our HACKING file at the top-level of our source distribution for details, but basically the indentation is inconsistent in some places, wrong in others, and and you have an opening brace that is wrong. See the footer for settings that can be automatically applied if you're using the emacs or vim editors. Those same settings can be set up in MSVC, Eclipse, and most any other development environment so the file is automatically formatted if recognizing and fixing all of the issues manually is frustrating.
Ok i used vim and to the best of my knowledge used the Hacking guide. the only thing that would be possibly non-compliant is the switch statement since it is not addressed in the hacking guide explicitly - i lined it up with the function statement as it is not specifically a function as per http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/HACKING?revision=HEAD section 3 braces.
The work on this task is ready to be reviewed.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
If you're using vim, you should be able to ":set modeline" to have it parse our footer, then you can auto-indent the entire file. Note the body of the two functions, for example -- you do not indent the convert_float() calls and they should be. Similarly, your latest version of convert_float() uses tabs and spaces inconsistently. The indentations levels should be 4s spaces, 1 tab, 1 tab plus 4 spaces, 2 tabs, 2 tabs + 4 spaces, etc.
The deadline of the task has been extended with 0 days and 12 hours.
Used vim, when i opened it i typed :set modeline in the command area.
then i did it. Counted indents. They're via the levels you said above.
the convention of
function type
function name + declaration
was used in the other files in libbu
so what about now? _
The work on this task is ready to be reviewed.
Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.
Congratulations, this task has been completed successfully.
That looks much better. Thank you! Hopefully the modeline feature will help you if you contribute other patches (lots of open source projects have a modeline defined).
We'll credit your name in our authorship documentation with this contribution, thanks again for working through the problems.
THANK YOU! :) Are you on IRC?
As GCI comes to a close, we wanted to take the time to say THANK YOU for all your efforts. This comment interface closes after GCI is over, so you're encouraged to join our mailing list where we'll be announcing contributions from GCI participants like yourelf over the upcoming months:
https://lists.sourceforge.net/lists/listinfo/brlcad-news
If you've provided your full name, we'll be sure to credit you in our authorship documentation and you'll see your name in a future announcement. If you contact us at devs@brlcad.org or via IRC, we'll even let you know when your work is integrated and follow up with updates. You're welcome and encouraged to contact us any time, especially if you have a question about how to continue participating in Open Source after GCI is over, but even if just to keep in touch. Note that ongoing participation in Open Source is one of the most impressive skills to have on your resumé. Take care, be well, and thank you again!