cppcheck: Simplify empty string test without using strlen()
[lttng-tools.git] / src / bin / lttng-sessiond / context.c
index c1b7410da00020dc541313326892d850e6810b28..a83cb46fc9dec796868dbb95157d901cb46cdb70 100644 (file)
@@ -201,7 +201,7 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
                        LTTNG_SYMBOL_NAME_LEN);
        kctx.u.perf_counter.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
 
-       if (strlen(channel_name) == 0) {
+       if (*channel_name == '\0') {
                ret = add_kctx_all_channels(ksession, &kctx);
                if (ret != LTTNG_OK) {
                        goto error;
@@ -241,6 +241,8 @@ int context_ust_add(struct ltt_ust_session *usess, int domain,
        assert(ctx);
        assert(channel_name);
 
+       rcu_read_lock();
+
        /*
         * Define which channel's hashtable to use from the domain or quit if
         * unknown domain.
@@ -260,7 +262,7 @@ int context_ust_add(struct ltt_ust_session *usess, int domain,
        }
 
        /* Get UST channel if defined */
-       if (strlen(channel_name) != 0) {
+       if (channel_name != '\0') {
                uchan = trace_ust_find_channel_by_name(chan_ht, channel_name);
                if (uchan == NULL) {
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
@@ -303,5 +305,6 @@ int context_ust_add(struct ltt_ust_session *usess, int domain,
        }
 
 error:
+       rcu_read_unlock();
        return ret;
 }
This page took 0.023312 seconds and 4 git commands to generate.