[Box Backup-commit] COMMIT r1033 - box/chris/general/bin/bbackupd
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Sat, 14 Oct 2006 15:56:10 +0100
Author: chris
Date: 2006-10-14 15:56:10 +0100 (Sat, 14 Oct 2006)
New Revision: 1033
Modified:
box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp
Log:
* Replace if/else tree with switch, to help compiler to optimise it and
detect errors
Modified: box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp
===================================================================
--- box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2006-10-14 14:54:59 UTC (rev 1032)
+++ box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2006-10-14 14:56:10 UTC (rev 1033)
@@ -244,27 +244,37 @@
if (!newService)
{
- if (err == ERROR_SERVICE_EXISTS)
+ switch (err)
{
- ::syslog(LOG_ERR, "Failed to create Box Backup "
- "service: it already exists");
+ case ERROR_SERVICE_EXISTS:
+ {
+ ::syslog(LOG_ERR, "Failed to create Box Backup "
+ "service: it already exists");
+ }
+ break;
+
+ case ERROR_SERVICE_MARKED_FOR_DELETE:
+ {
+ ::syslog(LOG_ERR, "Failed to create Box Backup "
+ "service: it is waiting to be deleted");
+ }
+ break;
+
+ case ERROR_DUPLICATE_SERVICE_NAME:
+ {
+ ::syslog(LOG_ERR, "Failed to create Box Backup "
+ "service: a service with this name "
+ "already exists");
+ }
+ break;
+
+ default:
+ {
+ ::syslog(LOG_ERR, "Failed to create Box Backup "
+ "service: error %d", err);
+ }
}
- else if (err == ERROR_SERVICE_MARKED_FOR_DELETE)
- {
- ::syslog(LOG_ERR, "Failed to create Box Backup "
- "service: it is waiting to be deleted");
- }
- else if (err == ERROR_DUPLICATE_SERVICE_NAME)
- {
- ::syslog(LOG_ERR, "Failed to create Box Backup "
- "service: a service with this name "
- "already exists");
- }
- else
- {
- ::syslog(LOG_ERR, "Failed to create Box Backup "
- "service: error %d", err);
- }
+
return 1;
}