21.02.2010, 21:27
Inline assembly is not always the best choice.
Edit:
Oops that comment should be direct towards the SDK developers.
_beginthreadex calls CreateThread/CreateThreadEx, since you have all the pp macros why not use the win32 equivalent as opposed to the CRT functions?
in n_mysql_connect(...) you have:
wouldnt the code below have the same result but less instructions?:
And does GetParam(...) return a COPY of the parameter?
Overall i saw alot of redundant code. This is not very fast at all...
Edit:
Oops that comment should be direct towards the SDK developers.
_beginthreadex calls CreateThread/CreateThreadEx, since you have all the pp macros why not use the win32 equivalent as opposed to the CRT functions?
in n_mysql_connect(...) you have:
Код:
if (!mysql_real_connect(my[h].mysql, host, user, pass, db, 0, NULL, 0)) { delete host; delete user; delete pass; delete db; GenerateError(h, "Failed to connect.", mysql_errno(my[h].mysql)); return -1; } mysql_options(my[h].mysql, MYSQL_OPT_RECONNECT, &my[h].reconnect); logprintf("MySQL: Connected (%d) to %s @ %s. MySQL version %s.", h, user, mysql_get_host_info(my[h].mysql), mysql_get_server_info(my[h].mysql)); if (my[h].logging == LOG_ALL) Log("Connected (%d) to %s @ %s. MySQL version %s.", h, user, mysql_get_host_info(my[h].mysql), mysql_get_server_info(my[h].mysql)); delete host; delete user; delete pass; delete db; my[h].connected = true; return h;
Код:
if (mysql_real_connect(my[h].mysql, host, user, pass, db, 0, NULL, 0)) { mysql_options(my[h].mysql, MYSQL_OPT_RECONNECT, &my[h].reconnect); logprintf("MySQL: Connected (%d) to %s @ %s. MySQL version %s.", h, user, mysql_get_host_info(my[h].mysql), mysql_get_server_info(my[h].mysql)); if (my[h].logging == LOG_ALL) Log("Connected (%d) to %s @ %s. MySQL version %s.", h, user, mysql_get_host_info(my[h].mysql), mysql_get_server_info(my[h].mysql)); my[h].connected = true; } else { GenerateError(h, "Failed to connect.", mysql_errno(my[h].mysql)); h = -1; } delete host; delete user; delete pass; delete db; return h;
Overall i saw alot of redundant code. This is not very fast at all...