[Opensrf-commits] r2005 - trunk/src/router (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Aug 14 20:57:55 EDT 2010


Author: scottmk
Date: 2010-08-14 20:57:53 -0400 (Sat, 14 Aug 2010)
New Revision: 2005

Modified:
   trunk/src/router/osrf_router_main.c
Log:
1. Pedantic change for const-correctness: replaced all calls to
jsonObjectGetKey() with calls to jsonObjectGetKeyConst().

2. Tidied up white space and comments here and there.

M    src/router/osrf_router_main.c


Modified: trunk/src/router/osrf_router_main.c
===================================================================
--- trunk/src/router/osrf_router_main.c	2010-08-14 21:38:11 UTC (rev 2004)
+++ trunk/src/router/osrf_router_main.c	2010-08-15 00:57:53 UTC (rev 2005)
@@ -94,7 +94,7 @@
 	int i;
 	for(i = 0; i < configInfo->size; i++) {
 		jsonObject* configChunk = jsonObjectGetIndex(configInfo, i);
-		if( ! jsonObjectGetKey( configChunk, "transport" ) )
+		if( ! jsonObjectGetKeyConst( configChunk, "transport" ) )
 		{
 			// In searching the configuration file for a given context, we may have found a
 			// spurious hit on an unrelated part of the configuration file that happened to use
@@ -115,8 +115,7 @@
 	}
 
 	if( parent ) {
-		// Wait for all child processes to terminate.
-		// If any ended abnormally, report it.
+		// Wait for all child processes to terminate; report their fates
 		while( 1 ) {  // Loop until all children terminate
 			int status;
 			errno = 0;
@@ -130,9 +129,9 @@
 				// or _exit(), or by returning from main()
 				int child_rc = WEXITSTATUS( status );
 				if( child_rc ) {
-					osrfLogWarning( OSRF_LOG_MARK,
+					osrfLogWarning( OSRF_LOG_MARK, 
 						"Child router process %ld exited with return status %d",
-						(long) child_pid, child_rc );
+	  					(long) child_pid, child_rc );
 					rc = EXIT_FAILURE;
 				} else {
 					;    // Terminated successfully; silently ignore
@@ -146,7 +145,7 @@
 					extra = "with core dump ";
 #endif
 				osrfLogWarning( OSRF_LOG_MARK, "Child router process %ld killed %sby signal %d",
-					(long) child_pid, extra, signo );
+	 				(long) child_pid, extra, signo );
 
 				rc = EXIT_FAILURE;
 			}
@@ -173,17 +172,17 @@
 */
 static void setupRouter(jsonObject* configChunk) {
 
-	jsonObject* transport_cfg = jsonObjectGetKey( configChunk, "transport" );
+	const jsonObject* transport_cfg = jsonObjectGetKeyConst( configChunk, "transport" );
 
-	const char* server   = jsonObjectGetString( jsonObjectGetKey( transport_cfg, "server" ) );
-	const char* port     = jsonObjectGetString( jsonObjectGetKey( transport_cfg, "port" ) );
-	const char* username = jsonObjectGetString( jsonObjectGetKey( transport_cfg, "username" ) );
-	const char* password = jsonObjectGetString( jsonObjectGetKey( transport_cfg, "password" ) );
-	const char* resource = jsonObjectGetString( jsonObjectGetKey( transport_cfg, "resource" ) );
+	const char* server   = jsonObjectGetString( jsonObjectGetKeyConst( transport_cfg, "server" ));
+	const char* port     = jsonObjectGetString( jsonObjectGetKeyConst( transport_cfg, "port" ));
+	const char* username = jsonObjectGetString( jsonObjectGetKeyConst( transport_cfg, "username" ));
+	const char* password = jsonObjectGetString( jsonObjectGetKeyConst( transport_cfg, "password" ));
+	const char* resource = jsonObjectGetString( jsonObjectGetKeyConst( transport_cfg, "resource" ));
 
-	const char* level    = jsonObjectGetString( jsonObjectGetKey( configChunk, "loglevel" ) );
-	const char* log_file = jsonObjectGetString( jsonObjectGetKey( configChunk, "logfile" ) );
-	const char* facility = jsonObjectGetString( jsonObjectGetKey( configChunk, "syslog" ) );
+	const char* level    = jsonObjectGetString( jsonObjectGetKeyConst( configChunk, "loglevel" ));
+	const char* log_file = jsonObjectGetString( jsonObjectGetKeyConst( configChunk, "logfile" ));
+	const char* facility = jsonObjectGetString( jsonObjectGetKeyConst( configChunk, "syslog" ));
 
 	int llevel = 1;
 	if(level) llevel = atoi(level);
@@ -242,6 +241,7 @@
 		osrfStringArrayAdd(tclients, clientDomain);
 	}
 
+
 	if( tclients->size == 0 || tservers->size == 0 ) {
 		osrfLogError( OSRF_LOG_MARK,
 				"We need trusted servers and trusted client to run the router...");



More information about the opensrf-commits mailing list