Fix for creating a spinlock without support spinlock https://github.com/lexborisov/myhtml/issues/103

This commit is contained in:
lexborisov 2017-05-19 18:47:17 +03:00
parent aa67db6fa1
commit 29cd7e1775
4 changed files with 127 additions and 0 deletions

View File

@ -0,0 +1,44 @@
/*
Copyright (C) 2016-2017 Alexander Borisov
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Author: lex.borisov@gmail.com (Alexander Borisov)
*/
#ifndef MyCSS_SYNTAX_ENDING_H
#define MyCSS_SYNTAX_ENDING_H
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "mycss/myosi.h"
#include "mycss/mycss.h"
#include "mycss/entry.h"
bool mycss_syntax_endings_list_of_rules_return(mycss_entry_t* entry, mycss_token_t* token);
bool mycss_syntax_endings_list_of_rules_qualified_rule_left_qb(mycss_entry_t* entry, mycss_token_t* token);
bool mycss_syntax_endings_list_of_rules_at_rule_qb(mycss_entry_t* entry, mycss_token_t* token);
bool mycss_syntax_endings_component_value_and_simple_block_left_curly_bracket(mycss_entry_t* entry, mycss_token_t* token);
bool mycss_syntax_endings_component_value_and_simple_block_left_square_bracket(mycss_entry_t* entry, mycss_token_t* token);
bool mycss_syntax_endings_component_value_and_simple_block_left_parenthesis(mycss_entry_t* entry, mycss_token_t* token);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* MyCSS_SYNTAX_ENDING_H */

View File

@ -0,0 +1,40 @@
/*
Copyright (C) 2016-2017 Alexander Borisov
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Author: lex.borisov@gmail.com (Alexander Borisov)
*/
#ifndef MyCSS_SYNTAX_H
#define MyCSS_SYNTAX_H
#pragma once
#ifdef __cplusplus
//extern "C" {
#endif
#include "mycss/myosi.h"
#include "mycss/mycss.h"
#include "mycss/entry.h"
#include "mycss/syntax_ending.h"
bool mycss_syntax_list_of_rules(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* MyCSS_SYNTAX_H */

View File

@ -0,0 +1,39 @@
/*
Copyright (C) 2016-2017 Alexander Borisov
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Author: lex.borisov@gmail.com (Alexander Borisov)
*/
#ifndef MyCSS_SYNTAX_ENDING_H
#define MyCSS_SYNTAX_ENDING_H
#pragma once
#ifdef __cplusplus
//extern "C" {
#endif
#include "mycss/myosi.h"
#include "mycss/mycss.h"
#include "mycss/entry.h"
bool mycss_syntax_list_of_rules(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* MyCSS_SYNTAX_ENDING_H */

View File

@ -47,7 +47,11 @@ static mcsync_status_t mcsync_static_atomic_unlock(void* spinlock)
/* spinlock */ /* spinlock */
void * mcsync_spin_create(void) void * mcsync_spin_create(void)
{ {
#ifndef MyCORE_MCSYNC_SPINLOCK_PRESENT
return mcsync_mutex_create();
#else
return mycore_calloc(1, sizeof(int)); return mycore_calloc(1, sizeof(int));
#endif
} }
mcsync_status_t mcsync_spin_init(void* spinlock) mcsync_status_t mcsync_spin_init(void* spinlock)