DragonFly bugs List (threaded) for 2004-10
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: cu coredumps
Timour Ezeev wrote:
You got the first case AFAIK, but for the second case you are loosing cp
when you assign it to tmp_cp. The possible solutions are:
Yeah, I didn't quite understand the second case. I was thinking that
because cp is just a local variable which holds the /dev/cuaa1 part (for
example) out of name (or atleast I think that's what it's doing), then
it wouldn't matter too much if I lost what was previously in cp?
1. Create new temp holder (in else) for cp and free() it after
assignment
or
2. If you dont want to create a new pointer, swap pointers in plase,
like this
(int)tmp_cp ^= (int)cp; (int)cp ^= (int)tmp_cp; (int)tmp_cp ^= (int)cp;
free(tmp_cp);
Pointers and dynamic memory allocation stuff still confuses me a bit,
which isn't much of a suprise considering I have only had 4 weeks of C
programming stuff at University, then they moved onto Matlab :(
What does the ^= mean in the above?
or something similar :)
Regards,
Thanks for your help!
--
Internet Explorer? Try FireFox at http://www.mozilla.org/products/firefox/
Outlook Express? Try ThunderBird at
http://www.mozilla.org/products/thunderbird/
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]