refacter(conf): use defines for standard includes (#5767)

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
Michael Simon
2024-03-20 05:10:33 +01:00
committed by GitHub
parent 393c24c6e9
commit 352420cd54
100 changed files with 210 additions and 167 deletions
@@ -20,7 +20,9 @@ extern "C" {
* DEFINES
*********************/
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
/**********************
* TYPEDEFS
@@ -203,7 +203,7 @@ static void ta_event_cb(lv_event_t * e)
lv_keyboard_set_textarea(kb, ta);
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_group_focus_obj(kb);
lv_group_set_editing(lv_obj_get_group(kb), kb);
lv_group_set_editing(lv_obj_get_group(kb), kb != NULL);
lv_obj_set_height(tv, LV_VER_RES / 2);
lv_obj_align(kb, LV_ALIGN_BOTTOM_MID, 0, 0);
}
+1 -1
View File
@@ -12,7 +12,7 @@
#include "lvgl/lvgl.h"
#endif
#if LV_USE_DEMO_MULTILANG
#if defined(LV_USE_DEMO_MULTILANG) || defined(LV_USE_DEMO_TRANSFORM)
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
@@ -1,5 +1,6 @@
#include "../../lv_examples.h"
#if LV_USE_QRCODE && LV_BUILD_EXAMPLES
#include <string.h>
/**
* Create a QR Code
@@ -59,7 +59,7 @@ static lv_subject_t auth_state_subject;
static void textarea_event_cb(lv_event_t * e)
{
lv_obj_t * ta = lv_event_get_target(e);
if(strcmp(lv_textarea_get_text(ta), "hello") == 0) {
if(lv_strcmp(lv_textarea_get_text(ta), "hello") == 0) {
lv_subject_set_int(&auth_state_subject, LOGGED_IN);
}
else {
@@ -14,8 +14,8 @@ static void btnm_event_handler(lv_event_t * e)
lv_obj_t * ta = lv_event_get_user_data(e);
const char * txt = lv_buttonmatrix_get_button_text(obj, lv_buttonmatrix_get_selected_button(obj));
if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_delete_char(ta);
else if(strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_obj_send_event(ta, LV_EVENT_READY, NULL);
if(lv_strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_delete_char(ta);
else if(lv_strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_obj_send_event(ta, LV_EVENT_READY, NULL);
else lv_textarea_add_text(ta, txt);
}
+6
View File
@@ -44,6 +44,12 @@
#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN
#define LV_STDINT_INCLUDE <stdint.h>
#define LV_STDDEF_INCLUDE <stddef.h>
#define LV_STDBOOL_INCLUDE <stdbool.h>
#define LV_INTTYPES_INCLUDE <inttypes.h>
#define LV_LIMITS_INCLUDE <limits.h>
#define LV_STDARG_INCLUDE <stdarg.h>
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
+2 -2
View File
@@ -15,8 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../draw/lv_draw.h"
#if LV_USE_DRAW_SW
@@ -39,6 +37,8 @@ extern "C" {
#include "../tick/lv_tick.h"
#include "../layouts/lv_layout.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES
*********************/
+1 -2
View File
@@ -6,12 +6,11 @@
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_group.h"
#include "../core/lv_obj.h"
#include "../core/lv_global.h"
#include "../indev/lv_indev.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES
-3
View File
@@ -13,11 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_ll.h"
+1 -2
View File
@@ -17,10 +17,9 @@
#include "../misc/lv_assert.h"
#include "../misc/lv_math.h"
#include "../misc/lv_log.h"
#include "../misc/lv_types.h"
#include "../tick/lv_tick.h"
#include "../stdlib/lv_string.h"
#include <stdint.h>
#include <string.h>
/*********************
* DEFINES
-2
View File
@@ -15,8 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_style.h"
#include "../misc/lv_area.h"
-2
View File
@@ -13,8 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_area.h"
#include "lv_obj_property.h"
-1
View File
@@ -13,7 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_event.h"
#include "../indev/lv_indev.h"
+1 -2
View File
@@ -13,10 +13,9 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_bidi.h"
#include "../misc/lv_style.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES
-2
View File
@@ -6,8 +6,6 @@
/*********************
* INCLUDES
*********************/
#include <stdlib.h>
#include "lv_obj.h"
#include "../indev/lv_indev.h"
#include "../indev/lv_indev_private.h"
-2
View File
@@ -13,8 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_anim.h"
#include "../display/lv_display.h"
+1 -1
View File
@@ -6,7 +6,6 @@
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_refr.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
@@ -14,6 +13,7 @@
#include "../misc/lv_timer.h"
#include "../misc/lv_math.h"
#include "../misc/lv_profiler.h"
#include "../misc/lv_types.h"
#include "../draw/lv_draw.h"
#include "../font/lv_font_fmt_txt.h"
#include "../stdlib/lv_string.h"
+1 -1
View File
@@ -15,7 +15,7 @@ extern "C" {
*********************/
#include "lv_obj.h"
#include "../display/lv_display.h"
#include <stdbool.h>
#include "../misc/lv_types.h"
/*********************
* DEFINES
+1 -1
View File
@@ -6,9 +6,9 @@
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "../core/lv_refr.h"
#include "../misc/lv_math.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
/*********************
+1 -1
View File
@@ -6,10 +6,10 @@
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lv_draw_mask.h"
#include "../core/lv_refr.h"
#include "../misc/lv_math.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
/*********************
+1 -1
View File
@@ -11,8 +11,8 @@
#if LV_USE_VECTOR_GRAPHIC
#include "../misc/lv_ll.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
#include <stdbool.h>
#include <math.h>
#include <float.h>
-1
View File
@@ -15,7 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include "lv_draw_buf.h"
#include "../misc/lv_fs.h"
#include "../misc/lv_types.h"
+2 -1
View File
@@ -6,11 +6,12 @@
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lv_draw_sw.h"
#if LV_USE_DRAW_SW
#include "../../misc/lv_math.h"
#include "../../misc/lv_types.h"
#include "../../core/lv_refr.h"
#include "../../stdlib/lv_string.h"
+1 -1
View File
@@ -13,10 +13,10 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "../../misc/lv_area.h"
#include "../../misc/lv_color.h"
#include "../../misc/lv_math.h"
#include "../../misc/lv_types.h"
/*********************
* DEFINES
+1
View File
@@ -12,6 +12,7 @@
#if LV_USE_DRAW_VG_LITE
#include "lv_vg_lite_utils.h"
#include <string.h>
/*********************
* DEFINES
+2
View File
@@ -12,6 +12,8 @@
#if LV_USE_DRAW_VG_LITE
#include "lv_vg_lite_utils.h"
#include <stdlib.h>
#include <string.h>
/*********************
* DEFINES
+4 -2
View File
@@ -13,6 +13,8 @@
#include "lv_draw_vg_lite_type.h"
#include "lv_vg_lite_pending.h"
#include "../../misc/lv_types.h"
#include "../../stdlib/lv_string.h"
/*********************
* DEFINES
@@ -236,8 +238,8 @@ static lv_cache_compare_res_t grad_compare_cb(const grad_item_t * lhs, const gra
return lhs->lv_grad.stops_count > rhs->lv_grad.stops_count ? 1 : -1;
}
int cmp_res = memcmp(lhs->lv_grad.stops, rhs->lv_grad.stops,
sizeof(lv_gradient_stop_t) * lhs->lv_grad.stops_count);
int cmp_res = lv_memcmp(lhs->lv_grad.stops, rhs->lv_grad.stops,
sizeof(lv_gradient_stop_t) * lhs->lv_grad.stops_count);
if(cmp_res != 0) {
return cmp_res > 0 ? 1 : -1;
}
+1
View File
@@ -15,6 +15,7 @@
#include <stdint.h>
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
+1
View File
@@ -22,6 +22,7 @@
#include <dirent.h>
#include <libinput.h>
#include <pthread.h>
#include <string.h>
#if LV_LIBINPUT_BSD
#include <dev/evdev/input.h>
+8 -10
View File
@@ -6,12 +6,10 @@
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stdbool.h>
#include "../lvgl.h"
#include "../misc/lv_fs.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
#include "lv_binfont_loader.h"
/**********************
@@ -208,7 +206,7 @@ static int read_label(lv_fs_file_t * fp, int start, const char * label)
if(lv_fs_read(fp, &length, 4, NULL) != LV_FS_RES_OK
|| lv_fs_read(fp, buf, 4, NULL) != LV_FS_RES_OK
|| memcmp(label, buf, 4) != 0) {
|| lv_memcmp(label, buf, 4) != 0) {
LV_LOG_WARN("Error reading '%s' label.", label);
return -1;
}
@@ -298,7 +296,7 @@ static int32_t load_cmaps(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, u
lv_font_fmt_txt_cmap_t * cmaps =
lv_malloc(cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
memset(cmaps, 0, cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
lv_memset(cmaps, 0, cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
font_dsc->cmaps = cmaps;
font_dsc->cmap_num = cmaps_subtables_count;
@@ -323,7 +321,7 @@ static int32_t load_glyph(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc,
lv_font_fmt_txt_glyph_dsc_t * glyph_dsc = (lv_font_fmt_txt_glyph_dsc_t *)
lv_malloc(loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
memset(glyph_dsc, 0, loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
lv_memset(glyph_dsc, 0, loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
font_dsc->glyph_dsc = glyph_dsc;
@@ -462,7 +460,7 @@ static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font)
lv_font_fmt_txt_dsc_t * font_dsc = (lv_font_fmt_txt_dsc_t *)
lv_malloc(sizeof(lv_font_fmt_txt_dsc_t));
memset(font_dsc, 0, sizeof(lv_font_fmt_txt_dsc_t));
lv_memset(font_dsc, 0, sizeof(lv_font_fmt_txt_dsc_t));
font->dsc = font_dsc;
@@ -579,7 +577,7 @@ int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t f
if(0 == kern_format_type) { /*sorted pairs*/
lv_font_fmt_txt_kern_pair_t * kern_pair = lv_malloc(sizeof(lv_font_fmt_txt_kern_pair_t));
memset(kern_pair, 0, sizeof(lv_font_fmt_txt_kern_pair_t));
lv_memset(kern_pair, 0, sizeof(lv_font_fmt_txt_kern_pair_t));
font_dsc->kern_dsc = kern_pair;
font_dsc->kern_classes = 0;
@@ -617,7 +615,7 @@ int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t f
lv_font_fmt_txt_kern_classes_t * kern_classes = lv_malloc(sizeof(lv_font_fmt_txt_kern_classes_t));
memset(kern_classes, 0, sizeof(lv_font_fmt_txt_kern_classes_t));
lv_memset(kern_classes, 0, sizeof(lv_font_fmt_txt_kern_classes_t));
font_dsc->kern_dsc = kern_classes;
font_dsc->kern_classes = 1;
+1 -4
View File
@@ -14,14 +14,11 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "lv_symbol_def.h"
#include "../draw/lv_draw_buf.h"
#include "../misc/lv_area.h"
#include "../misc/lv_types.h"
#include "../misc/cache/lv_cache.h"
/*********************
+1 -3
View File
@@ -13,10 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "lv_font.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES
+1
View File
@@ -11,6 +11,7 @@
#include "lv_libpng.h"
#include <png.h>
#include <string.h>
/*********************
* DEFINES
+1
View File
@@ -10,6 +10,7 @@
#if LV_USE_RLOTTIE
#include <rlottie_capi.h>
#include <string.h>
/*********************
* DEFINES
+1
View File
@@ -13,6 +13,7 @@
#include "tjpgd.h"
#include "lv_tjpgd.h"
#include "../../misc/lv_fs.h"
#include <string.h>
/*********************
* DEFINES
+42
View File
@@ -124,6 +124,48 @@
#endif
#endif
#ifndef LV_STDINT_INCLUDE
#ifdef CONFIG_LV_STDINT_INCLUDE
#define LV_STDINT_INCLUDE CONFIG_LV_STDINT_INCLUDE
#else
#define LV_STDINT_INCLUDE <stdint.h>
#endif
#endif
#ifndef LV_STDDEF_INCLUDE
#ifdef CONFIG_LV_STDDEF_INCLUDE
#define LV_STDDEF_INCLUDE CONFIG_LV_STDDEF_INCLUDE
#else
#define LV_STDDEF_INCLUDE <stddef.h>
#endif
#endif
#ifndef LV_STDBOOL_INCLUDE
#ifdef CONFIG_LV_STDBOOL_INCLUDE
#define LV_STDBOOL_INCLUDE CONFIG_LV_STDBOOL_INCLUDE
#else
#define LV_STDBOOL_INCLUDE <stdbool.h>
#endif
#endif
#ifndef LV_INTTYPES_INCLUDE
#ifdef CONFIG_LV_INTTYPES_INCLUDE
#define LV_INTTYPES_INCLUDE CONFIG_LV_INTTYPES_INCLUDE
#else
#define LV_INTTYPES_INCLUDE <inttypes.h>
#endif
#endif
#ifndef LV_LIMITS_INCLUDE
#ifdef CONFIG_LV_LIMITS_INCLUDE
#define LV_LIMITS_INCLUDE CONFIG_LV_LIMITS_INCLUDE
#else
#define LV_LIMITS_INCLUDE <limits.h>
#endif
#endif
#ifndef LV_STDARG_INCLUDE
#ifdef CONFIG_LV_STDARG_INCLUDE
#define LV_STDARG_INCLUDE CONFIG_LV_STDARG_INCLUDE
#else
#define LV_STDARG_INCLUDE <stdarg.h>
#endif
#endif
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
+1 -1
View File
@@ -13,8 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lv_conf_internal.h"
#include "misc/lv_types.h"
/*********************
* DEFINES
+1 -2
View File
@@ -15,8 +15,7 @@ extern "C" {
*********************/
#include "lv_cache_entry.h"
#include "lv_cache_private.h"
#include <stdbool.h>
#include <stdlib.h>
#include "../lv_types.h"
#include "_lv_cache_lru_rb.h"
-2
View File
@@ -16,8 +16,6 @@ extern "C" {
#include "../../osal/lv_os.h"
#include "../lv_types.h"
#include "lv_cache_private.h"
#include <stdbool.h>
#include <stdlib.h>
/*********************
* DEFINES
*********************/
-2
View File
@@ -14,8 +14,6 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_types.h"
#include <stdbool.h>
#include <stdlib.h>
#include "../../osal/lv_os.h"
/*********************
* DEFINES
-2
View File
@@ -14,8 +14,6 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_types.h"
#include <stdbool.h>
#include <stdlib.h>
#include "../../osal/lv_os.h"
/*********************
-4
View File
@@ -19,10 +19,6 @@ extern "C" {
#include "lv_timer.h"
#include "lv_ll.h"
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
/*********************
* DEFINES
*********************/
-3
View File
@@ -15,9 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include "lv_types.h"
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
/*********************
* DEFINES
-4
View File
@@ -13,10 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "lv_types.h"
/*********************
+1 -1
View File
@@ -6,9 +6,9 @@
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_bidi.h"
#include "lv_text.h"
#include "lv_types.h"
#include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h"
+1 -3
View File
@@ -14,9 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdbool.h>
#include <stdint.h>
#include "lv_types.h"
#include "lv_text.h"
/*********************
-2
View File
@@ -17,8 +17,6 @@ extern "C" {
#include "lv_assert.h"
#include "lv_math.h"
#include "lv_types.h"
#include <stdint.h>
#include <stdbool.h>
/*********************
* DEFINES
+1 -1
View File
@@ -16,7 +16,7 @@ extern "C" {
#include "lv_assert.h"
#include "lv_math.h"
#include "lv_color.h"
#include <stdint.h>
#include "lv_types.h"
/*********************
* DEFINES
+1 -1
View File
@@ -10,7 +10,7 @@
#include "../core/lv_global.h"
#include "../stdlib/lv_mem.h"
#include "lv_assert.h"
#include <stddef.h>
#include "lv_types.h"
/*********************
* DEFINES

Some files were not shown because too many files have changed in this diff Show More