mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Now, parser correctly finishes parse procedure if syntax of source code is incorrect (syntax correctness is indicated using return value): - parser-internal memory management is performed using jsp_mm_alloc / jsp_mm_free; - upon detection of incorrect syntax, all parser-allocated memory regions are deallocated using jsp_mm_free_all and parse finishes with corresponding return value. JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
39 lines
1.4 KiB
C
39 lines
1.4 KiB
C
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
/**
|
|
This file contains functions to create and manipulate hash-tables.
|
|
Before using the hash initialize it by calling hash_table_init function.
|
|
The function takes pointer to hash function as the last parameter.
|
|
URGENT: the result of the hash function must not be greater than size of the hash table.
|
|
To insert a key-value pair, use hash_table_insert function.
|
|
To lookup a value by the key, use hash_table_lookup function.
|
|
After using the hash, delete it by calling hash_table_free function.
|
|
*/
|
|
#ifndef HASH_TABLE_H
|
|
#define HASH_TABLE_H
|
|
|
|
#include "mem-heap.h"
|
|
|
|
typedef void* hash_table;
|
|
#define null_hash NULL
|
|
|
|
hash_table hash_table_init (uint8_t, uint8_t, uint16_t, uint16_t (*hash) (void *));
|
|
void hash_table_free (hash_table);
|
|
void hash_table_insert (hash_table, void *, void *);
|
|
void *hash_table_lookup (hash_table, void *);
|
|
|
|
#endif /* HASH_TABLE_H */
|