qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1643262 - in /qpid/dispatch/trunk: ./ doc/book/ python/qpid_dispatch/management/ router/src/ src/
Date Fri, 05 Dec 2014 12:59:29 GMT
Author: tross
Date: Fri Dec  5 12:59:28 2014
New Revision: 1643262

Log:
NO-JIRA - Removed tabs from source files.

Modified:
    qpid/dispatch/trunk/CMakeLists.txt
    qpid/dispatch/trunk/doc/book/release-0.1.md
    qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json
    qpid/dispatch/trunk/router/src/main.c
    qpid/dispatch/trunk/src/agent.c
    qpid/dispatch/trunk/src/connection_manager.c
    qpid/dispatch/trunk/src/entity.c
    qpid/dispatch/trunk/src/error.c
    qpid/dispatch/trunk/src/iterator.c
    qpid/dispatch/trunk/src/log.c
    qpid/dispatch/trunk/src/router_config.c
    qpid/dispatch/trunk/src/router_pynode.c
    qpid/dispatch/trunk/src/waypoint.c

Modified: qpid/dispatch/trunk/CMakeLists.txt
==============================================================================
--- qpid/dispatch/trunk/CMakeLists.txt (original)
+++ qpid/dispatch/trunk/CMakeLists.txt Fri Dec  5 12:59:28 2014
@@ -131,7 +131,7 @@ install(FILES
   DESTINATION ${DOC_INSTALL_DIR}/qpid-dispatch)
 
 
-add_subdirectory(src)	# Build src first so other subdirs can use QPID_DISPATCH_LIB
+add_subdirectory(src)    # Build src first so other subdirs can use QPID_DISPATCH_LIB
 add_subdirectory(tests)
 add_subdirectory(python)
 add_subdirectory(doc)

Modified: qpid/dispatch/trunk/doc/book/release-0.1.md
==============================================================================
--- qpid/dispatch/trunk/doc/book/release-0.1.md (original)
+++ qpid/dispatch/trunk/doc/book/release-0.1.md Fri Dec  5 12:59:28 2014
@@ -176,7 +176,7 @@ routers' management addresses.
         Receiver receiver = session.createReceiver("#");
         Address responseAddress = receiver.getAddress();
 
-    	Message request;
+        Message request;
         request.setReplyTo(responseAddress);
         request.setProperty("x-amqp-to", "amqp:/_local/$management");
         request.setProperty("operation", "DISCOVER-MGMT-NODES");

Modified: qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json Fri Dec  5 12:59:28
2014
@@ -162,9 +162,9 @@
                     "default": 60,
                     "description": "Time in seconds after which mobile addresses are declared
stale if no RA is received"
                 },
-	            "addrCount": {"type": "Integer", "description":"Number of addresses known to
the router"},
-	            "linkCount": {"type": "Integer", "description":"Number of links attached to
the router node"},
-	            "nodeCount": {"type": "Integer", "description":"Number of known peer router
nodes"}
+                "addrCount": {"type": "Integer", "description":"Number of addresses known
to the router"},
+                "linkCount": {"type": "Integer", "description":"Number of links attached
to the router node"},
+                "nodeCount": {"type": "Integer", "description":"Number of known peer router
nodes"}
             }
         },
 
@@ -241,12 +241,12 @@
                         "MESSAGE",
                         "SERVER",
                         "CAGENT",
-	                    "AGENT",
+                        "AGENT",
                         "CONTAINER",
                         "CONFIG",
                         "DEFAULT",
                         "ERROR",
-	                    "DISPATCH"
+                        "DISPATCH"
                     ],
                     "required": true,
                     "description": "Module to configure logging level. The special module
'DEFAULT' specifies logging for modules that don't have explicit log sections."
@@ -354,8 +354,8 @@
             "attributes": {
                 "arg1": {"type": "String"},
                 "arg2": {"type": "String"},
-	            "num1": {"type": "Integer"},
-	            "num2": {"type": "Integer"}
+                "num1": {"type": "Integer"},
+                "num2": {"type": "Integer"}
             }
         },
 
@@ -364,11 +364,11 @@
             "operations": ["READ"],
             "include": ["common"],
             "attributes": {
-	            "linkType": {"type": ["endpoint", "waypoint", "inter-router", "inter-area"]},
-	            "linkDir": {"type": ["in", "out"]},
-	            "owningAddr": {"type": "String"},
-	            "eventFifoDepth": {"type": "Integer"},
-	            "msgFifoDepth": {"type": "Integer"}
+                "linkType": {"type": ["endpoint", "waypoint", "inter-router", "inter-area"]},
+                "linkDir": {"type": ["in", "out"]},
+                "owningAddr": {"type": "String"},
+                "eventFifoDepth": {"type": "Integer"},
+                "msgFifoDepth": {"type": "Integer"}
             }
         },
 
@@ -377,14 +377,14 @@
             "operations": ["READ"],
             "include": ["common"],
             "attributes": {
-	            "inProcess": {"type": "Boolean"},
-	            "subscriberCount": {"type": "Integer"},
-	            "remoteCount": {"type": "Integer"},
-	            "deliveriesIngress": {"type": "Integer"},
-	            "deliveriesEgress": {"type": "Integer"},
-	            "deliveriesTransit": {"type": "Integer"},
-	            "deliveriesToContainer": {"type": "Integer"},
-	            "deliveriesFromContainer": {"type": "Integer"}
+                "inProcess": {"type": "Boolean"},
+                "subscriberCount": {"type": "Integer"},
+                "remoteCount": {"type": "Integer"},
+                "deliveriesIngress": {"type": "Integer"},
+                "deliveriesEgress": {"type": "Integer"},
+                "deliveriesTransit": {"type": "Integer"},
+                "deliveriesToContainer": {"type": "Integer"},
+                "deliveriesFromContainer": {"type": "Integer"}
             }
         },
 
@@ -393,10 +393,10 @@
             "operations": ["READ"],
             "include": ["common"],
             "attributes": {
-	            "addr": {"type": "String"},
-	            "nextHop": {"type": "Integer"},
-	            "routerLink": {"type": "Integer"},
-	            "validOrigins": {"type": "List"}
+                "addr": {"type": "String"},
+                "nextHop": {"type": "Integer"},
+                "routerLink": {"type": "Integer"},
+                "validOrigins": {"type": "List"}
             }
         },
 
@@ -405,18 +405,18 @@
             "operations": ["READ"],
             "include": ["common"],
             "attributes": {
-	            "container": {"type": "String"} ,
-	            "state": {"type": [
-	                "connecting",
-	                "opening",
-	                "operational",
-	                "failed",
-	                "user"
-	            ]},
-	            "host": {"type": "String"},
-	            "dir": {"type": ["in", "out"]},
-	            "role": {"type": "String"},
-	            "sasl": {"type": "String"}
+                "container": {"type": "String"} ,
+                "state": {"type": [
+                    "connecting",
+                    "opening",
+                    "operational",
+                    "failed",
+                    "user"
+                ]},
+                "host": {"type": "String"},
+                "dir": {"type": ["in", "out"]},
+                "role": {"type": "String"},
+                "sasl": {"type": "String"}
             }
         },
 
@@ -425,15 +425,15 @@
             "operations": ["READ"],
             "include": ["common"],
             "attributes": {
-	            "typeSize": {"type": "Integer"},
-	            "transferBatchSize": {"type": "Integer"},
-	            "localFreeListMax": {"type": "Integer"},
-	            "globalFreeListMax": {"type": "Integer"},
-	            "totalAllocFromHeap": {"type": "Integer"},
-	            "totalFreeToHeap": {"type": "Integer"},
-	            "heldByThreads": {"type": "Integer"},
-	            "batchesRebalancedToThreads": {"type": "Integer"},
-	            "batchesRebalancedToGlobal": {"type": "Integer"}
+                "typeSize": {"type": "Integer"},
+                "transferBatchSize": {"type": "Integer"},
+                "localFreeListMax": {"type": "Integer"},
+                "globalFreeListMax": {"type": "Integer"},
+                "totalAllocFromHeap": {"type": "Integer"},
+                "totalFreeToHeap": {"type": "Integer"},
+                "heldByThreads": {"type": "Integer"},
+                "batchesRebalancedToThreads": {"type": "Integer"},
+                "batchesRebalancedToGlobal": {"type": "Integer"}
             }
         }
     }

Modified: qpid/dispatch/trunk/router/src/main.c
==============================================================================
--- qpid/dispatch/trunk/router/src/main.c (original)
+++ qpid/dispatch/trunk/router/src/main.c Fri Dec  5 12:59:28 2014
@@ -81,10 +81,10 @@ static void server_signal_handler(void*
 
 static void check(int fd) {
     if (qd_error_code()) {
-	qd_log(log_source, QD_LOG_CRITICAL, "Router start-up failed: %s", qd_error_message());
-    if (fd > 0)
+        qd_log(log_source, QD_LOG_CRITICAL, "Router start-up failed: %s", qd_error_message());
+        if (fd > 0)
         write(fd, "X", 1);
-	exit(1);
+        exit(1);
     }
 }
 

Modified: qpid/dispatch/trunk/src/agent.c
==============================================================================
--- qpid/dispatch/trunk/src/agent.c (original)
+++ qpid/dispatch/trunk/src/agent.c Fri Dec  5 12:59:28 2014
@@ -212,7 +212,7 @@ static void qd_agent_send_error(
     qd_amqp_error_t code, const char *text)
 {
     qd_agent_send_response(agent, qd_agent_setup_error(agent, reply_to, cid, code, text),
-			   0, reply_to);
+                           0, reply_to);
 }
 
 static void qd_agent_insert_attr_names(qd_composed_field_t    *field,
@@ -401,8 +401,8 @@ static void qd_agent_process_object_quer
             // If the entityType was specified but not found, return an error.
             //
             if (cls_record == 0) {
-		char entity[QD_ERROR_MAX];
-		qd_field_iterator_strncpy(cls_string, entity, sizeof(entity));
+                char entity[QD_ERROR_MAX];
+                qd_field_iterator_strncpy(cls_string, entity, sizeof(entity));
                 qd_agent_send_error(agent, reply_to, cid, QD_AMQP_NOT_FOUND, entity);
                 break;
             }
@@ -607,8 +607,8 @@ static void qd_agent_process_request(qd_
     // Parse the message through the body and exit if the message is not well formed.
     //
     if (!qd_message_check(msg, QD_DEPTH_BODY)) {
-	LOG(ERROR, "Cannot parse request: %s", qd_error_message());
-	return;
+        LOG(ERROR, "Cannot parse request: %s", qd_error_message());
+        return;
     }
 
     //
@@ -616,7 +616,7 @@ static void qd_agent_process_request(qd_
     //
     qd_field_iterator_t *reply_to = qd_message_field_iterator(msg, QD_FIELD_REPLY_TO);
     if (reply_to == 0) {
-	LOG(ERROR, "Reqeust has no reply-to");
+        LOG(ERROR, "Reqeust has no reply-to");
         return;
     }
 
@@ -630,8 +630,8 @@ static void qd_agent_process_request(qd_
     //
     qd_field_iterator_t *ap = qd_message_field_iterator(msg, QD_FIELD_APPLICATION_PROPERTIES);
     if (ap == 0) {
-	qd_agent_send_error(agent, reply_to, cid, QD_AMQP_BAD_REQUEST, "No application-properties");
-	return;
+        qd_agent_send_error(agent, reply_to, cid, QD_AMQP_BAD_REQUEST, "No application-properties");
+        return;
     }
 
     //
@@ -641,7 +641,7 @@ static void qd_agent_process_request(qd_
     if (map == 0) {
         qd_field_iterator_free(ap);
         qd_field_iterator_free(reply_to);
-	qd_agent_send_error(agent, reply_to, cid, QD_AMQP_BAD_REQUEST, "Application-properties not
a map");
+        qd_agent_send_error(agent, reply_to, cid, QD_AMQP_BAD_REQUEST, "Application-properties
not a map");
         return;
     }
 
@@ -652,7 +652,7 @@ static void qd_agent_process_request(qd_
         qd_field_iterator_free(ap);
         qd_field_iterator_free(reply_to);
         qd_parse_free(map);
-	qd_agent_send_error(agent, reply_to, cid, QD_AMQP_BAD_REQUEST, "Application-properties not
a map");
+        qd_agent_send_error(agent, reply_to, cid, QD_AMQP_BAD_REQUEST, "Application-properties
not a map");
         return;
     }
 
@@ -664,7 +664,7 @@ static void qd_agent_process_request(qd_
         qd_parse_free(map);
         qd_field_iterator_free(ap);
         qd_field_iterator_free(reply_to);
-	qd_agent_send_error(agent, reply_to, cid, QD_AMQP_BAD_REQUEST, "No operation");
+        qd_agent_send_error(agent, reply_to, cid, QD_AMQP_BAD_REQUEST, "No operation");
         return;
     }
 
@@ -687,8 +687,8 @@ static void qd_agent_process_request(qd_
     else if (qd_field_iterator_equal(operation_string, (unsigned char*) OP_GET_MGMT_NODES))
         qd_agent_process_discover_nodes(agent, map, reply_to, cid);
     else {
-	char op[QD_ERROR_MAX];
-	qd_field_iterator_strncpy(operation_string, op, sizeof(op));
+        char op[QD_ERROR_MAX];
+        qd_field_iterator_strncpy(operation_string, op, sizeof(op));
         qd_agent_send_error(agent, reply_to, cid, QD_AMQP_NOT_IMPLEMENTED, op);
     }
 

Modified: qpid/dispatch/trunk/src/connection_manager.c
==============================================================================
--- qpid/dispatch/trunk/src/connection_manager.c (original)
+++ qpid/dispatch/trunk/src/connection_manager.c Fri Dec  5 12:59:28 2014
@@ -60,7 +60,7 @@ struct qd_connection_manager_t {
 // True if entity has any of attributes.
 static bool has_attrs(qd_entity_t *entity, const char **attributes, int n) {
     for (int i = 0; i < n; ++i)
-	if (qd_entity_has(entity, attributes[i])) return true;
+        if (qd_entity_has(entity, attributes[i])) return true;
     return false;
 }
 
@@ -143,17 +143,17 @@ qd_error_t qd_dispatch_configure_connect
     qd_config_connector_t *cc = NEW(qd_config_connector_t);
     memset(cc, 0, sizeof(*cc));
     if (load_server_config(qd, &cc->configuration, entity))
-	return qd_error_code();
+        return qd_error_code();
     DEQ_ITEM_INIT(cc);
     if (strcmp(cc->configuration.role, "on-demand") == 0) {
-	cc->connector_name = qd_entity_string(entity, "name"); QD_ERROR_RET();
-	DEQ_INSERT_TAIL(cm->on_demand_connectors, cc);
-	qd_log(cm->log_source, QD_LOG_INFO, "Configured on-demand connector: %s:%s name=%s",
-	       cc->configuration.host, cc->configuration.port, cc->connector_name);
+        cc->connector_name = qd_entity_string(entity, "name"); QD_ERROR_RET();
+        DEQ_INSERT_TAIL(cm->on_demand_connectors, cc);
+        qd_log(cm->log_source, QD_LOG_INFO, "Configured on-demand connector: %s:%s name=%s",
+               cc->configuration.host, cc->configuration.port, cc->connector_name);
     } else {
-	DEQ_INSERT_TAIL(cm->config_connectors, cc);
-	qd_log(cm->log_source, QD_LOG_INFO, "Configured Connector: %s:%s role=%s",
-	       cc->configuration.host, cc->configuration.port, cc->configuration.role);
+        DEQ_INSERT_TAIL(cm->config_connectors, cc);
+        qd_log(cm->log_source, QD_LOG_INFO, "Configured Connector: %s:%s role=%s",
+               cc->configuration.host, cc->configuration.port, cc->configuration.role);
     }
     return QD_ERROR_NONE;
 }

Modified: qpid/dispatch/trunk/src/entity.c
==============================================================================
--- qpid/dispatch/trunk/src/entity.c (original)
+++ qpid/dispatch/trunk/src/entity.c Fri Dec  5 12:59:28 2014
@@ -80,25 +80,25 @@ bool qd_entity_bool(qd_entity_t *entity,
 char *qd_entity_opt_string(qd_entity_t *entity, const char* attribute, const char* default_value)
 {
     if (qd_entity_has(entity, attribute))
-	return qd_entity_string(entity, attribute);
+        return qd_entity_string(entity, attribute);
     else
-	return default_value ? strdup(default_value) : NULL;
+        return default_value ? strdup(default_value) : NULL;
 }
 
 long qd_entity_opt_long(qd_entity_t *entity, const char* attribute, long default_value) {
     if (qd_entity_has(entity, attribute)) {
-	long result = qd_entity_long(entity, attribute);
-	if (!qd_error_code())
-	    return result;
+        long result = qd_entity_long(entity, attribute);
+        if (!qd_error_code())
+            return result;
     }
     return default_value;
 }
 
 bool qd_entity_opt_bool(qd_entity_t *entity, const char* attribute, bool default_value) {
     if (qd_entity_has(entity, attribute)) {
-	bool result = qd_entity_bool(entity, attribute);
-	if (!qd_error_code())
-	    return result;
+        bool result = qd_entity_bool(entity, attribute);
+        if (!qd_error_code())
+            return result;
     }
     return default_value;
 }

Modified: qpid/dispatch/trunk/src/error.c
==============================================================================
--- qpid/dispatch/trunk/src/error.c (original)
+++ qpid/dispatch/trunk/src/error.c Fri Dec  5 12:59:28 2014
@@ -60,21 +60,21 @@ qd_error_t qd_error_impl(qd_error_t code
     if (code) {
         char *begin = ts.error_message;
         char *end = begin + ERROR_MAX;
-	const char* name = qd_error_name(code);
+        const char* name = qd_error_name(code);
         if (name)
             aprintf(&begin, end, "%s: ", name);
-	else
-	    aprintf(&begin, end, "%d: ", code);
-	va_list arglist;
-	va_start(arglist, fmt);
-	vaprintf(&begin, end, fmt, arglist);
-	va_end(arglist);
+        else
+            aprintf(&begin, end, "%d: ", code);
+        va_list arglist;
+        va_start(arglist, fmt);
+        vaprintf(&begin, end, fmt, arglist);
+        va_end(arglist);
         // NOTE: Use the file/line from the qd_error macro, not this line in error.c
-	qd_log_impl(log_source, QD_LOG_ERROR, file, line, "%s", qd_error_message());
-	return code;
+        qd_log_impl(log_source, QD_LOG_ERROR, file, line, "%s", qd_error_message());
+        return code;
     }
     else
-	qd_error_clear();
+        qd_error_clear();
     return 0;
 }
 
@@ -116,56 +116,55 @@ static void log_trace_py(PyObject *type,
     py_set_item(locals, "trace", trace);
 
     PyObject *result = PyRun_String(
-	"'\\n'.join(traceback.format_exception(type, value, trace))", Py_eval_input, globals, locals);
+                                    "'\\n'.join(traceback.format_exception(type, value, trace))",
Py_eval_input, globals, locals);
     Py_DECREF(globals);
     Py_DECREF(locals);
 
 
     if (result) {
-	const char* trace = PyString_AsString(result);
-	if (strlen(trace) < QD_LOG_TEXT_MAX) {
-	    qd_log_impl(log_source, level, file, line, "%s", trace);
-	} else {
-	    // Keep as much of the the tail of the trace as we can.
-	    const char *tail = trace;
-	    while (tail && strlen(tail) > QD_LOG_TEXT_MAX) {
-		tail = strchr(tail, '\n');
-		if (tail) ++tail;
-	    }
-	    qd_log_impl(log_source, level, file, line, "Traceback truncated:\n%s", tail ? tail :
"");
-	}
-	Py_DECREF(result);
+        const char* trace = PyString_AsString(result);
+        if (strlen(trace) < QD_LOG_TEXT_MAX) {
+            qd_log_impl(log_source, level, file, line, "%s", trace);
+        } else {
+            // Keep as much of the the tail of the trace as we can.
+            const char *tail = trace;
+            while (tail && strlen(tail) > QD_LOG_TEXT_MAX) {
+                tail = strchr(tail, '\n');
+                if (tail) ++tail;
+            }
+            qd_log_impl(log_source, level, file, line, "Traceback truncated:\n%s", tail ?
tail : "");
+        }
+        Py_DECREF(result);
     }
-
 }
 
 qd_error_t qd_error_py_impl(const char *file, int line) {
     if (PyErr_Occurred()) {
-	PyObject *type, *value, *trace;
-	PyErr_Fetch(&type, &value, &trace); /* Note clears the python error indicator
*/
+        PyObject *type, *value, *trace;
+        PyErr_Fetch(&type, &value, &trace); /* Note clears the python error indicator
*/
 
-	PyObject *py_type_name = type ? PyObject_GetAttrString(type, "__name__") : NULL;
+        PyObject *py_type_name = type ? PyObject_GetAttrString(type, "__name__") : NULL;
         const char *type_name = py_type_name ? PyString_AsString(py_type_name) : NULL;
 
-	PyObject *py_value_str = value ? PyObject_Str(value) : NULL;
+        PyObject *py_value_str = value ? PyObject_Str(value) : NULL;
         const char *value_str = py_value_str ? PyString_AsString(py_value_str) : NULL;
         if (!value_str) value_str = "Unknown";
 
         PyErr_Clear(); /* Ignore errors while we're trying to build the values. */
-	if (type_name)
-	    qd_error_impl(QD_ERROR_PYTHON, file, line, "%s: %s", type_name, value_str);
-	else
-	    qd_error_impl(QD_ERROR_PYTHON, file, line, "%s", value_str);
-	Py_XDECREF(py_value_str);
-	Py_XDECREF(py_type_name);
-
-	log_trace_py(type, value, trace, QD_LOG_ERROR, file, line);
-
-	Py_XDECREF(type);
-	Py_XDECREF(value);
-	Py_XDECREF(trace);
+        if (type_name)
+            qd_error_impl(QD_ERROR_PYTHON, file, line, "%s: %s", type_name, value_str);
+        else
+            qd_error_impl(QD_ERROR_PYTHON, file, line, "%s", value_str);
+        Py_XDECREF(py_value_str);
+        Py_XDECREF(py_type_name);
+
+        log_trace_py(type, value, trace, QD_LOG_ERROR, file, line);
+
+        Py_XDECREF(type);
+        Py_XDECREF(value);
+        Py_XDECREF(trace);
     } else {
-	qd_error_clear();
+        qd_error_clear();
     }
     return qd_error_code();
 }

Modified: qpid/dispatch/trunk/src/iterator.c
==============================================================================
--- qpid/dispatch/trunk/src/iterator.c (original)
+++ qpid/dispatch/trunk/src/iterator.c Fri Dec  5 12:59:28 2014
@@ -476,7 +476,7 @@ int qd_field_iterator_ncopy(qd_field_ite
     qd_field_iterator_reset(iter);
     int i = 0;
     while (!qd_field_iterator_end(iter) && i < n)
-	buffer[i++] = qd_field_iterator_octet(iter);
+        buffer[i++] = qd_field_iterator_octet(iter);
     return i;
 }
 

Modified: qpid/dispatch/trunk/src/log.c
==============================================================================
--- qpid/dispatch/trunk/src/log.c (original)
+++ qpid/dispatch/trunk/src/log.c Fri Dec  5 12:59:28 2014
@@ -91,27 +91,27 @@ static log_sink_t* find_log_sink_lh(cons
 static log_sink_t* log_sink_lh(const char* name) {
     log_sink_t* sink = find_log_sink_lh(name);
     if (sink)
-	sink->refcount++;
+        sink->refcount++;
     else {
-	sink = NEW(log_sink_t);
-	*sink = (log_sink_t){ 1, strdup(name), };
-	if (strcmp(name, SINK_STDERR) == 0) {
-	    sink->file = stderr;
-	}
-	else if (strcmp(name, SINK_SYSLOG) == 0) {
-	    openlog(0, 0, LOG_DAEMON);
-	    sink->syslog = true;
-	}
-	else {
-	    sink->file = fopen(name, "w");
-	    if (!sink->file) {
-		char msg[TEXT_MAX];
-		snprintf(msg, sizeof(msg), "Failed to open log file '%s'", name);
-		perror(msg);
-		exit(1);
-	    }
-	}
-	DEQ_INSERT_TAIL(sink_list, sink);
+        sink = NEW(log_sink_t);
+        *sink = (log_sink_t){ 1, strdup(name), };
+        if (strcmp(name, SINK_STDERR) == 0) {
+            sink->file = stderr;
+        }
+        else if (strcmp(name, SINK_SYSLOG) == 0) {
+            openlog(0, 0, LOG_DAEMON);
+            sink->syslog = true;
+        }
+        else {
+            sink->file = fopen(name, "w");
+            if (!sink->file) {
+                char msg[TEXT_MAX];
+                snprintf(msg, sizeof(msg), "Failed to open log file '%s'", name);
+                perror(msg);
+                exit(1);
+            }
+        }
+        DEQ_INSERT_TAIL(sink_list, sink);
     }
     return sink;
 }
@@ -121,12 +121,12 @@ static void log_sink_free_lh(log_sink_t*
     if (!sink) return;
     assert(sink->refcount);
     if (--sink->refcount == 0) {
-	DEQ_REMOVE(sink_list, sink);
-	free(sink->name);
-	if (sink->file && sink->file != stderr)
-	    fclose(sink->file);
-	if (sink->syslog) closelog();
-	free(sink);
+        DEQ_REMOVE(sink_list, sink);
+        free(sink->name);
+        if (sink->file && sink->file != stderr)
+            fclose(sink->file);
+        if (sink->syslog) closelog();
+        free(sink);
     }
 }
 
@@ -149,8 +149,8 @@ static qd_log_source_list_t  source_list
 typedef enum {NONE, TRACE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, N_LEVELS} level_index_t;
 typedef struct level {
     const char* name;
-    int bit;			// QD_LOG bit
-    int mask;			// Bit or higher
+    int bit;     // QD_LOG bit
+    int mask;    // Bit or higher
     const int syslog;
 } level;
 #define ALL_BITS (QD_LOG_CRITICAL | (QD_LOG_CRITICAL-1))
@@ -171,9 +171,9 @@ static const level* level_for_bit(int bi
     level_index_t i = 0;
     while (i < N_LEVELS && levels[i].bit != bit) ++i;
     if (i == N_LEVELS) {
-	qd_log(logging_log_source, QD_LOG_ERROR, "'%d' is not a valid log level bit. Defaulting
to %s", bit, levels[INFO].name);
-	i = INFO;
-	assert(0);
+        qd_log(logging_log_source, QD_LOG_ERROR, "'%d' is not a valid log level bit. Defaulting
to %s", bit, levels[INFO].name);
+        i = INFO;
+        assert(0);
     }
     return &levels[i];
 }
@@ -182,8 +182,8 @@ static const level* level_for_name(const
     level_index_t i = 0;
     while (i < N_LEVELS && strcasecmp(levels[i].name, name) != 0) ++i;
     if (i == N_LEVELS) {
-	qd_log(logging_log_source, QD_LOG_ERROR, "'%s' is not a valid log level. Should be one of
{%s}. Defaulting to %s", name, level_names, levels[INFO].name);
-	i = INFO;
+        qd_log(logging_log_source, QD_LOG_ERROR, "'%s' is not a valid log level. Should be
one of {%s}. Defaulting to %s", name, level_names, levels[INFO].name);
+        i = INFO;
     }
     return &levels[i];
 }
@@ -192,7 +192,7 @@ static const level* level_for_name(const
 static qd_log_source_t* lookup_log_source_lh(const char *module)
 {
     if (strcasecmp(module, SOURCE_DEFAULT) == 0)
-	return default_log_source;
+        return default_log_source;
     qd_log_source_t *src = DEQ_HEAD(source_list);
     DEQ_FIND(src, strcasecmp(module, src->module) == 0);
     return src;
@@ -216,26 +216,26 @@ static void write_log(qd_log_source_t *l
         buf[0] = '\0';
         ctime_r(&entry->time, buf);
         buf[strlen(buf)-1] = '\0'; /* Get rid of trailng \n */
-	aprintf(&begin, end, "%s ", buf);
+        aprintf(&begin, end, "%s ", buf);
     }
     aprintf(&begin, end, "%s (%s) %s", entry->module, level_for_bit(entry->level)->name,
entry->text);
     if (default_bool(log_source->source, default_log_source->source))
-	aprintf(&begin, end, " (%s:%d)", entry->file, entry->line);
+        aprintf(&begin, end, " (%s:%d)", entry->file, entry->line);
     aprintf(&begin, end, "\n");
 
     if (sink->file) {
-	if (fputs(log_str, sink->file) == EOF) {
-	    char msg[TEXT_MAX];
-	    snprintf(msg, sizeof(msg), "Cannot write log output to '%s'", sink->name);
-	    perror(msg);
-	    exit(1);
-	};
-	fflush(sink->file);
+        if (fputs(log_str, sink->file) == EOF) {
+            char msg[TEXT_MAX];
+            snprintf(msg, sizeof(msg), "Cannot write log output to '%s'", sink->name);
+            perror(msg);
+            exit(1);
+        };
+        fflush(sink->file);
     }
     if (sink->syslog) {
-	int syslog_level = level_for_bit(entry->level)->syslog;
-	if (syslog_level != -1)
-	    syslog(syslog_level, "%s", log_str);
+        int syslog_level = level_for_bit(entry->level)->syslog;
+        if (syslog_level != -1)
+            syslog(syslog_level, "%s", log_str);
     }
 }
 
@@ -253,10 +253,10 @@ static qd_log_source_t *qd_log_source_lh
     qd_log_source_t *log_source = lookup_log_source_lh(module);
     if (!log_source)
     {
-	log_source = NEW(qd_log_source_t);
-	memset(log_source, 0, sizeof(qd_log_source_t));
-	DEQ_ITEM_INIT(log_source);
-	log_source->module = module;
+        log_source = NEW(qd_log_source_t);
+        memset(log_source, 0, sizeof(qd_log_source_t));
+        DEQ_ITEM_INIT(log_source);
+        log_source->module = module;
         qd_log_source_defaults(log_source);
         DEQ_INSERT_TAIL(source_list, log_source);
     }
@@ -313,7 +313,7 @@ void qd_log_impl(qd_log_source_t *source
     sys_mutex_lock(log_lock);
     DEQ_INSERT_TAIL(entries, entry);
     if (DEQ_SIZE(entries) > LIST_MAX)
-	qd_log_entry_free_lh(entry);
+        qd_log_entry_free_lh(entry);
     sys_mutex_unlock(log_lock);
 }
 
@@ -324,8 +324,8 @@ void qd_log_initialize(void)
     DEQ_INIT(sink_list);
     strcpy((char*)level_names, levels[NONE].name);
     for (level_index_t i = NONE+1; i < N_LEVELS; ++i) {
-	strcat((char*)level_names, ", ");
-	strcat((char*)level_names, levels[i].name);
+        strcat((char*)level_names, ", ");
+        strcat((char*)level_names, levels[i].name);
     }
     log_lock = sys_mutex();
     log_source_lock = sys_mutex();
@@ -341,11 +341,11 @@ void qd_log_initialize(void)
 
 void qd_log_finalize(void) {
     while (DEQ_HEAD(source_list))
-	qd_log_source_free_lh(DEQ_HEAD(source_list));
+        qd_log_source_free_lh(DEQ_HEAD(source_list));
     while (DEQ_HEAD(entries))
         qd_log_entry_free_lh(DEQ_HEAD(entries));
     while (DEQ_HEAD(sink_list))
-	log_sink_free_lh(DEQ_HEAD(sink_list));
+        log_sink_free_lh(DEQ_HEAD(sink_list));
 }
 
 qd_error_t qd_log_entity(qd_entity_t *entity) {
@@ -364,20 +364,20 @@ qd_error_t qd_log_entity(qd_entity_t *en
     free(level);
 
     if (qd_entity_has(entity, "timestamp"))
-	copy.timestamp = qd_entity_bool(entity, "timestamp");
+        copy.timestamp = qd_entity_bool(entity, "timestamp");
     QD_ERROR_RET();
 
     if (qd_entity_has(entity, "source"))
-	copy.source = qd_entity_bool(entity, "source");
+        copy.source = qd_entity_bool(entity, "source");
     QD_ERROR_RET();
 
     if (qd_entity_has(entity, "output")) {
-	log_sink_free_lh(copy.sink); /* DEFAULT source may already have a sink */
-	char* output = qd_entity_string(entity, "output"); QD_ERROR_RET();
-	copy.sink = log_sink_lh(output);
-	free(output);
-	if (copy.sink->syslog) /* Timestamp off for syslog. */
-	    copy.timestamp = 0;
+        log_sink_free_lh(copy.sink); /* DEFAULT source may already have a sink */
+        char* output = qd_entity_string(entity, "output"); QD_ERROR_RET();
+        copy.sink = log_sink_lh(output);
+        free(output);
+        if (copy.sink->syslog) /* Timestamp off for syslog. */
+            copy.timestamp = 0;
     }
 
     sys_mutex_lock(log_source_lock);

Modified: qpid/dispatch/trunk/src/router_config.c
==============================================================================
--- qpid/dispatch/trunk/src/router_config.c (original)
+++ qpid/dispatch/trunk/src/router_config.c Fri Dec  5 12:59:28 2014
@@ -34,7 +34,7 @@ qd_error_t qd_router_configure_address(q
 
     if (phase < 0 || phase > 9) {
         free(prefix);
-	return qd_error(QD_ERROR_CONFIG, "Invalid phase %d for prefix '%s' must be between 0 and
9.  Ignoring", phase, prefix);
+        return qd_error(QD_ERROR_CONFIG, "Invalid phase %d for prefix '%s' must be between
0 and 9.  Ignoring", phase, prefix);
     }
 
     //
@@ -42,25 +42,25 @@ qd_error_t qd_router_configure_address(q
     //
     qd_config_address_t *addr = DEQ_HEAD(router->config_addrs);
     while (addr) {
-	if (strcmp(addr->prefix, prefix) == 0)
-	    break;
-	addr = DEQ_NEXT(addr);
+        if (strcmp(addr->prefix, prefix) == 0)
+            break;
+        addr = DEQ_NEXT(addr);
     }
 
     if (addr == 0) {
-	//
-	// Create a new prefix
-	//
-	addr = NEW(qd_config_address_t);
-	DEQ_ITEM_INIT(addr);
-	addr->prefix = (char*) malloc(strlen(prefix) + 1);
-	addr->last_phase = (char) phase + '0';
-	DEQ_INIT(addr->phases);
-	DEQ_INSERT_TAIL(router->config_addrs, addr);
-	if (prefix[0] == '/')
-	    strcpy(addr->prefix, &prefix[1]);
-	else
-	    strcpy(addr->prefix, prefix);
+        //
+        // Create a new prefix
+        //
+        addr = NEW(qd_config_address_t);
+        DEQ_ITEM_INIT(addr);
+        addr->prefix = (char*) malloc(strlen(prefix) + 1);
+        addr->last_phase = (char) phase + '0';
+        DEQ_INIT(addr->phases);
+        DEQ_INSERT_TAIL(router->config_addrs, addr);
+        if (prefix[0] == '/')
+            strcpy(addr->prefix, &prefix[1]);
+        else
+            strcpy(addr->prefix, prefix);
     }
 
     //
@@ -87,15 +87,15 @@ qd_error_t qd_router_configure_address(q
             free(prefix);
             return qd_error(QD_ERROR_CONFIG, "Invalid bias value %d", fanout);
         }
-	qd_log(router->log_source, QD_LOG_INFO,
-		   "Configured Address: prefix=%s phase=%d fanout=%s bias=%s",
-		   prefix, phase,
-		   qd_schema_fixedAddress_fanout_names[fanout],
-		   qd_schema_fixedAddress_bias_names[bias]);
+        qd_log(router->log_source, QD_LOG_INFO,
+               "Configured Address: prefix=%s phase=%d fanout=%s bias=%s",
+               prefix, phase,
+               qd_schema_fixedAddress_fanout_names[fanout],
+               qd_schema_fixedAddress_bias_names[bias]);
     } else {
-	semantics |= QD_BIAS_NONE;
-	qd_log(router->log_source, QD_LOG_INFO, "Configured Address: prefix=%s phase=%d fanout=%s",
-	       prefix, phase, qd_schema_fixedAddress_fanout_names[fanout]);
+        semantics |= QD_BIAS_NONE;
+        qd_log(router->log_source, QD_LOG_INFO, "Configured Address: prefix=%s phase=%d
fanout=%s",
+               prefix, phase, qd_schema_fixedAddress_fanout_names[fanout]);
     }
 
     addr_phase->semantics = semantics;
@@ -116,7 +116,7 @@ qd_error_t qd_router_configure_waypoint(
     if (in_phase > 9 || out_phase > 9) {
         free(address);
         free(connector);
-	return qd_error(QD_ERROR_CONFIG, "Phases for waypoint '%s' must be between 0 and 9.", address);
+        return qd_error(QD_ERROR_CONFIG, "Phases for waypoint '%s' must be between 0 and
9.", address);
     }
     qd_waypoint_t *waypoint = NEW(qd_waypoint_t);
     memset(waypoint, 0, sizeof(qd_waypoint_t));
@@ -129,8 +129,8 @@ qd_error_t qd_router_configure_waypoint(
     DEQ_INSERT_TAIL(router->waypoints, waypoint);
 
     qd_log(router->log_source, QD_LOG_INFO,
-	   "Configured Waypoint: address=%s in_phase=%d out_phase=%d connector=%s",
-	   address, in_phase, out_phase, connector);
+           "Configured Waypoint: address=%s in_phase=%d out_phase=%d connector=%s",
+           address, in_phase, out_phase, connector);
     return qd_error_code();
 }
 

Modified: qpid/dispatch/trunk/src/router_pynode.c
==============================================================================
--- qpid/dispatch/trunk/src/router_pynode.c (original)
+++ qpid/dispatch/trunk/src/router_pynode.c Fri Dec  5 12:59:28 2014
@@ -636,7 +636,7 @@ qd_error_t qd_pyrouter_tick(qd_router_t
         pArgs  = PyTuple_New(0);
         pValue = PyObject_CallObject(pyTick, pArgs);
         Py_DECREF(pArgs);
-	Py_XDECREF(pValue);
+        Py_XDECREF(pValue);
         qd_python_unlock(lock_state);
     }
     return qd_error_py();
@@ -656,9 +656,9 @@ void qd_router_mobile_added(qd_router_t
         pArgs = PyTuple_New(1);
         PyTuple_SetItem(pArgs, 0, PyString_FromString(address));
         pValue = PyObject_CallObject(pyAdded, pArgs);
-	qd_error_py();
+        qd_error_py();
         Py_DECREF(pArgs);
-	Py_XDECREF(pValue);
+        Py_XDECREF(pValue);
         qd_python_unlock(lock_state);
 
         free(address);
@@ -676,9 +676,9 @@ void qd_router_mobile_removed(qd_router_
         pArgs = PyTuple_New(1);
         PyTuple_SetItem(pArgs, 0, PyString_FromString(address));
         pValue = PyObject_CallObject(pyRemoved, pArgs);
-	qd_error_py();
+        qd_error_py();
         Py_DECREF(pArgs);
-	Py_XDECREF(pValue);
+        Py_XDECREF(pValue);
         qd_python_unlock(lock_state);
     }
 }
@@ -694,9 +694,9 @@ void qd_router_link_lost(qd_router_t *ro
         pArgs = PyTuple_New(1);
         PyTuple_SetItem(pArgs, 0, PyInt_FromLong((long) link_mask_bit));
         pValue = PyObject_CallObject(pyLinkLost, pArgs);
-	qd_error_py();
+        qd_error_py();
         Py_DECREF(pArgs);
-	Py_XDECREF(pValue);
+        Py_XDECREF(pValue);
         qd_python_unlock(lock_state);
     }
 }

Modified: qpid/dispatch/trunk/src/waypoint.c
==============================================================================
--- qpid/dispatch/trunk/src/waypoint.c (original)
+++ qpid/dispatch/trunk/src/waypoint.c Fri Dec  5 12:59:28 2014
@@ -74,12 +74,12 @@ static void qd_waypoint_visit_sink_LH(qd
 
         wp->in_address = addr;
         qd_field_iterator_free(iter);
-	LOG(TRACE, "Sink in-address=%s, in-phase=%c",
-	    qd_address_logstr(wp->in_address), wp->in_phase);
+        LOG(TRACE, "Sink in-address=%s, in-phase=%c",
+            qd_address_logstr(wp->in_address), wp->in_phase);
     }
 
     if (!wp->connected) {
-	LOG(TRACE, "Sink start connector %s", wp->connector_name);
+        LOG(TRACE, "Sink start connector %s", wp->connector_name);
         qd_connection_manager_start_on_demand(qd, wp->connector);
     }
     else if (!wp->out_link) {
@@ -114,7 +114,7 @@ static void qd_waypoint_visit_sink_LH(qd
         pn_link_open(qd_link_pn(wp->out_link));
         qd_link_activate(wp->out_link);
 
-	LOG(TRACE, "Sink out-link '%s'", pn_link_name(qd_link_pn(wp->out_link)));
+        LOG(TRACE, "Sink out-link '%s'", pn_link_name(qd_link_pn(wp->out_link)));
     }
 }
 
@@ -149,12 +149,12 @@ static void qd_waypoint_visit_source_LH(
 
         wp->out_address = addr;
         qd_field_iterator_free(iter);
-	LOG(TRACE, "Source out-address=%s, out-phase=%c",
-	    qd_address_logstr(wp->out_address), wp->out_phase);
+        LOG(TRACE, "Source out-address=%s, out-phase=%c",
+            qd_address_logstr(wp->out_address), wp->out_phase);
     }
 
     if (!wp->connected) {
-	LOG(TRACE, "Source start connector %s", wp->connector_name);
+        LOG(TRACE, "Source start connector %s", wp->connector_name);
         qd_connection_manager_start_on_demand(qd, wp->connector);
     }
     else if (!wp->in_link) {
@@ -181,7 +181,7 @@ static void qd_waypoint_visit_source_LH(
         pn_link_open(qd_link_pn(wp->in_link));
         qd_link_activate(wp->in_link);
 
-	LOG(TRACE, "Source in-link '%s'", pn_link_name(qd_link_pn(wp->in_link)));
+        LOG(TRACE, "Source in-link '%s'", pn_link_name(qd_link_pn(wp->in_link)));
     }
     if (wp->in_link && (DEQ_SIZE(addr->rlinks) + DEQ_SIZE(addr->rnodes)
> 0)) {
         //
@@ -319,7 +319,7 @@ void qd_waypoint_address_updated_LH(qd_d
 {
     qd_waypoint_t *wp = DEQ_HEAD(qd->router->waypoints);
     while (wp) {
-	LOG(TRACE, "Updated address %s", qd_address_logstr(addr));
+        LOG(TRACE, "Updated address %s", qd_address_logstr(addr));
         if (wp->out_address == addr)
             qd_waypoint_visit_LH(qd, wp);
         wp = DEQ_NEXT(wp);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message