BytesClub / serverX

A HTTP/HTTPS Web Server Handler by (C) Bytes Club
Other
3 stars 3 forks source link

Optimization: strlen has been called more than once over same string #1

Closed 0xTheProDev closed 7 years ago

0xTheProDev commented 7 years ago

Link:

krhitesh commented 7 years ago

Instead of: char* t = calloc(strlen(s) + 1, 1); //Line 890 use: int s_len;

char* t = calloc(s_len=strlen(s) + 1, 1); Use s_len in Line 898 too instead of strlen(s).

0xTheProDev commented 7 years ago

@hitesh1157 Thanks for your suggestion. You may look into this issue and send us pull request when you're done. In the meantime, we will like you to go through our Contribution Guide and Coding Style.