Hi Isaac,
I didn't remove the initalization, i gets created and initialized directly
in front of the loop.
Also it actually might be unnecessary with some compilers or flags, newly
created variables/memory should be always initialized. Otherwise it's
probably a bug.
Regards,
Björn
Sent with AquaMail for Android
http://www.aqua-mail.com
On November 18, 2014 11:29:47 PM Isaac Rose <isaacdr...@gmail.com> wrote:
The change " for (; i < arrayList_size(loghelper->logServices); i++)" does
not specify the initial value for the i. This is based on the assumption
that the compiler will automatically set it to zero, correct? Is that a
save assumption or is Celix only expected to be compiled with a specific
compiler with specific flags? If so where is that documented?
Isaac
On Tue, Nov 18, 2014 at 5:23 PM, <bpe...@apache.org> wrote:
> Author: bpetri
> Date: Tue Nov 18 22:23:00 2014
> New Revision: 1640437
>
> URL: http://svn.apache.org/r1640437
> Log:
> CELIX-182: minor refactoring
>
> Modified:
> celix/trunk/log_service/CMakeLists.txt
> celix/trunk/log_service/public/src/log_helper.c
>
> Modified: celix/trunk/log_service/CMakeLists.txt
> URL:
>
http://svn.apache.org/viewvc/celix/trunk/log_service/CMakeLists.txt?rev=1640437&r1=1640436&r2=1640437&view=diff
>
>
==============================================================================
> --- celix/trunk/log_service/CMakeLists.txt (original)
> +++ celix/trunk/log_service/CMakeLists.txt Tue Nov 18 22:23:00 2014
> @@ -38,8 +38,10 @@ if (LOG_SERVICE)
> )
>
> install_bundle(log_service
> - HEADERS
> - public/include/log_service.h
> + HEADERS
> + public/include/log_service.h
> public/include/log_helper.h
> + RESOURCES
> + public/src/log_helper.c
> )
>
> include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
>
> Modified: celix/trunk/log_service/public/src/log_helper.c
> URL:
>
http://svn.apache.org/viewvc/celix/trunk/log_service/public/src/log_helper.c?rev=1640437&r1=1640436&r2=1640437&view=diff
>
>
==============================================================================
> --- celix/trunk/log_service/public/src/log_helper.c (original)
> +++ celix/trunk/log_service/public/src/log_helper.c Tue Nov 18 22:23:00
> 2014
> @@ -129,19 +129,16 @@ celix_status_t logHelper_log(log_helper_
> if (loghelper != NULL) {
> pthread_mutex_lock(&loghelper->logListLock);
>
> - if (arrayList_size(loghelper->logServices) > 0) {
> - int i = 0;
> + int i = 0;
>
> - for (; i < arrayList_size(loghelper->logServices);
> i++) {
> + for (; i < arrayList_size(loghelper->logServices); i++) {
>
> - log_service_pt logService =
> arrayList_get(loghelper->logServices, i);
> + log_service_pt logService =
> arrayList_get(loghelper->logServices, i);
>
> - if (logService != NULL) {
> -
> (logService->log)(logService->logger, level, message);
> - logged = true;
> - }
> + if (logService != NULL) {
> + (logService->log)(logService->logger,
> level, message);
> + logged = true;
> }
> -
> }
>
> pthread_mutex_unlock(&loghelper->logListLock);
>
>
>