diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-22 01:11:19 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-22 01:11:19 +0000 |
commit | 16e667a2cecf9492954333fc7949b6636072f941 (patch) | |
tree | 746164afdc56c0a30dea0f1736c4129c1f1ad422 /src/misc.c | |
parent | 1532aa675f7c28b8ff0061ebc21f374d36d89d65 (diff) |
Replaced most uses of smalloc and scalloc with new, replaced most uses of free with delete.
NOTE: This build is unstable due to lack of memory zeroing, this will be addresses in a future commit.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1783 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/misc.c')
-rw-r--r-- | src/misc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/misc.c b/src/misc.c index 77eee30cc..437d9ece4 100644 --- a/src/misc.c +++ b/src/misc.c @@ -777,7 +777,7 @@ char *myStrSubString(const char *src, int start, int end) } len = strlen(src); if (((start >= 0) && (end <= len)) && (end > start)) { - substring = (char *) malloc(sizeof(char) * ((end - start) + 1)); + substring = new char[(end - start) + 1]; for (idx = 0; idx <= end - start; idx++) { substring[idx] = src[start + idx]; } @@ -865,7 +865,7 @@ int nickIsServices(const char *tempnick, int bot) if (s) { *s++ = 0; if (stricmp(s, ServerName) != 0) { - free(nick); + delete [] nick; return found; } } @@ -900,7 +900,7 @@ int nickIsServices(const char *tempnick, int bot) } /* Somehow, something tells me we should free this :) -GD */ - free(nick); + delete [] nick; return found; } @@ -1328,7 +1328,7 @@ char *GetWindowsVersion(void) snprintf(buf, sizeof(buf), "Microsoft Windows Server 2008 %s%s", cputype, extra); } - free(extra); + delete [] extra; } /* Windows 2003 or Windows XP Pro 64 */ if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) { @@ -1350,7 +1350,7 @@ char *GetWindowsVersion(void) snprintf(buf, sizeof(buf), "Microsoft Windows Server 2003 Family %s%s", cputype, extra); } - free(extra); + delete [] extra; } if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) { if (osvi.wSuiteMask & VER_SUITE_EMBEDDEDNT) { @@ -1361,7 +1361,7 @@ char *GetWindowsVersion(void) extra = sstrdup(" "); } snprintf(buf, sizeof(buf), "Microsoft Windows XP %s", extra); - free(extra); + delete [] extra; } if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) { if (osvi.wSuiteMask & VER_SUITE_DATACENTER) { @@ -1372,7 +1372,7 @@ char *GetWindowsVersion(void) extra = sstrdup("Server"); } snprintf(buf, sizeof(buf), "Microsoft Windows 2000 %s", extra); - free(extra); + delete [] extra; } if (osvi.dwMajorVersion <= 4) { if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) { @@ -1381,7 +1381,7 @@ char *GetWindowsVersion(void) extra = sstrdup("Server 4.0"); } snprintf(buf, sizeof(buf), "Microsoft Windows NT %s", extra); - free(extra); + delete [] extra; } case VER_PLATFORM_WIN32_WINDOWS: if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) { @@ -1391,7 +1391,7 @@ char *GetWindowsVersion(void) extra = sstrdup(" "); } snprintf(buf, sizeof(buf), "Microsoft Windows 95 %s", extra); - free(extra); + delete [] extra; } if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) { if (osvi.szCSDVersion[1] == 'A') { @@ -1400,14 +1400,14 @@ char *GetWindowsVersion(void) extra = sstrdup(" "); } snprintf(buf, sizeof(buf), "Microsoft Windows 98 %s", extra); - free(extra); + delete [] extra; } if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) { snprintf(buf, sizeof(buf), "Microsoft Windows Millennium Edition"); } } - free(cputype); + delete [] cputype; return sstrdup(buf); } |