Merge commit 'db48ee553797312ab0b796797942a1c14db16c62' into nanostack-release-candidate

* commit 'db48ee553797312ab0b796797942a1c14db16c62':
  Squashed 'features/FEATURE_COMMON_PAL/nanostack-libservice/' changes from 854505d..09056ed
pull/5511/head
Arto Kinnunen 2017-11-16 14:22:17 +02:00
commit 4d08d5b34e
3 changed files with 39 additions and 11 deletions

View File

@ -1,6 +1,20 @@
/*
* Copyright (c) 2016 ARM Limited. All rights reserved.
*/
// ----------------------------------------------------------------------------
// Copyright 2016-2017 ARM Ltd.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------
/**
* NanoStack NVM helper functions to read, write and delete key-value pairs to platform NVM.

View File

@ -46,7 +46,7 @@ struct ns_mem_book {
static ns_mem_book_t *default_book; // heap pointer for original "ns_" API use
// size of a hole_t in our word units
#define HOLE_T_SIZE ((sizeof(hole_t) + sizeof(ns_mem_word_size_t) - 1) / sizeof(ns_mem_word_size_t))
#define HOLE_T_SIZE ((ns_mem_word_size_t) ((sizeof(hole_t) + sizeof(ns_mem_word_size_t) - 1) / sizeof(ns_mem_word_size_t)))
static NS_INLINE hole_t *hole_from_block_start(ns_mem_word_size_t *start)
{
@ -334,8 +334,8 @@ static void ns_mem_free_and_merge_with_adjacent_blocks(ns_mem_book_t *book, ns_m
if (start != book->heap_main) {
if (*(start - 1) < 0) {
int *block_end = start - 1;
size_t block_size = 1 + (-*block_end) + 1;
ns_mem_word_size_t *block_end = start - 1;
ns_mem_word_size_t block_size = 1 + (-*block_end) + 1;
merged_data_size += block_size;
start -= block_size;
if (*start != *block_end) {
@ -349,8 +349,8 @@ static void ns_mem_free_and_merge_with_adjacent_blocks(ns_mem_book_t *book, ns_m
if (end != book->heap_main_end) {
if (*(end + 1) < 0) {
int *block_start = end + 1;
size_t block_size = 1 + (-*block_start) + 1;
ns_mem_word_size_t *block_start = end + 1;
ns_mem_word_size_t block_size = 1 + (-*block_start) + 1;
merged_data_size += block_size;
end += block_size;
if (*end != *block_start) {

View File

@ -1,6 +1,20 @@
/*
* Copyright (c) 2016 ARM Limited. All rights reserved.
*/
// ----------------------------------------------------------------------------
// Copyright 2016-2017 ARM Ltd.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------
#include <string.h>
#include <ns_types.h>