Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 1522-?-?Refactoring C code
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

alextooter
Ketchup Master

55 Posts

Posted - Jun 12 2006 :  01:24:51 AM  Show Profile  Reply with Quote
When I want to refactoring some C code, 1522 will using the C++ technology "reference",
but there is no reference in C, so those code can't be compiled,


example

orignail c code

GLOBAL void tcpmDoUdpRegisterReq(T_TCPIP_UDPREG_REQ *tcpip_udpreg_req)
{
struct socket *so_p;
UdpRegisterCnf udpRegisterCnf;
T_TCPIP_UDPALLOCATE_REQ udpAllocateReq;
UdpAllocateCnf udpAllocateCnf;

/*
* i will refactoring the following code using extract method
* begin:
*/
udpRegisterCnf.tsapi = tcpip_udpreg_req->tsapi;
udpRegisterCnf.localPort = 0;
udpRegisterCnf.localAddress.addr.addrV4 = 0;
udpRegisterCnf.localAddress.addrType = IP_V4_ADDRESS;
udpRegisterCnf.isRegister = tcpip_udpreg_req->isRegister;
udpRegisterCnf.recvSize = 0;
udpRegisterCnf.sendSize = 0;
udpRegisterCnf.commandRef = tcpip_udpreg_req->commandRef;
/*
* end.
*/
}

after refactoring:

void
MyMethod (UdpRegisterCnf &udpRegisterCnf, //here is the problem, no & in C
T_TCPIP_UDPREG_REQ *tcpip_udpreg_req)

{

udpRegisterCnf.tsapi = tcpip_udpreg_req->tsapi;

udpRegisterCnf.localPort = 0;

udpRegisterCnf.localAddress.addr.addrV4 = 0;

udpRegisterCnf.localAddress.addrType = IP_V4_ADDRESS;

udpRegisterCnf.isRegister = tcpip_udpreg_req->isRegister;

udpRegisterCnf.recvSize = 0;

udpRegisterCnf.sendSize = 0;

udpRegisterCnf.commandRef = tcpip_udpreg_req->commandRef;

}

GLOBAL void tcpmDoUdpRegisterReq(T_TCPIP_UDPREG_REQ *tcpip_udpreg_req)
{
struct socket *so_p;
UdpRegisterCnf udpRegisterCnf;
T_TCPIP_UDPALLOCATE_REQ udpAllocateReq;
UdpAllocateCnf udpAllocateCnf;

MyMethod(udpRegisterCnf, tcpip_udpreg_req);
}

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Jun 13 2006 :  5:09:46 PM  Show Profile  Reply with Quote
which IDE are you using? VS2003 does not seem keen on me adding a C file to my C++ project

zen is the art of being at one with the two'ness
Go to Top of Page

alextooter
Ketchup Master

55 Posts

Posted - Jun 13 2006 :  8:23:01 PM  Show Profile  Reply with Quote
I am using vc6, and this project is a C project (for handset).
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Jun 14 2006 :  5:56:32 PM  Show Profile  Reply with Quote
i am seeing the same thing

case=1317

for now the best advice is to either select the extracted method and use find / replace on the selected code to turn "foo." into "foo->" and then fix any errors, or to avoid extract method in C for now. most (or even all) of the other refactoring operations should be fine in C.

zen is the art of being at one with the two'ness
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Aug 12 2006 :  11:22:39 PM  Show Profile  Reply with Quote
Case 1317 is fixed in build 1532.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000