mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-29 12:32:54 +00:00
misc: collect misc scripts
This commit is contained in:
parent
724f400dd4
commit
070c8da6de
25
tool/misc/add_callback_to_ds_process.cocci
Normal file
25
tool/misc/add_callback_to_ds_process.cocci
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
// replace struct btstack_data_source with btstack_data_source_t in function definitions
|
||||
@@
|
||||
identifier handler;
|
||||
identifier ds;
|
||||
typedef btstack_data_source_t;
|
||||
@@
|
||||
- int handler(struct btstack_data_source * ds)
|
||||
+ int handler(btstack_data_source_t* ds)
|
||||
{ ... }
|
||||
|
||||
@btstack_run_loop_set_data_source_handler@
|
||||
identifier handler;
|
||||
expression ds;
|
||||
@@
|
||||
btstack_run_loop_set_data_source_handler(ds, &handler);
|
||||
|
||||
@@
|
||||
identifier btstack_run_loop_set_data_source_handler.handler;
|
||||
identifier ds;
|
||||
typedef btstack_data_source_callback_type_t;
|
||||
@@
|
||||
- int handler(btstack_data_source_t * ds)
|
||||
+ void handler(btstack_data_source_t * ds, btstack_data_source_callback_type_t callback_type)
|
||||
{ ... }
|
20
tool/misc/drop_internal.py
Normal file
20
tool/misc/drop_internal.py
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
def do(name):
|
||||
name_without = name.replace('_internal','')
|
||||
print("s/%s/%s/g" % (name, name_without))
|
||||
|
||||
do('l2cap_create_channel_internal')
|
||||
do('l2cap_disconnect_internal')
|
||||
do('l2cap_send_internal')
|
||||
do('l2cap_register_service_internal')
|
||||
do('l2cap_unregister_service_internal')
|
||||
do('l2cap_accept_connection_internal')
|
||||
do('l2cap_decline_connection_internal')
|
||||
do('l2cap_le_register_service_internal')
|
||||
do('l2cap_le_unregister_service_internal')
|
||||
do('rfcomm_create_channel_internal')
|
||||
do('rfcomm_create_channel_with_initial_credits_internal')
|
||||
do('rfcomm_register_service_with_initial_credits_internal')
|
||||
do('rfcomm_unregister_service_internal')
|
||||
do('rfcomm_decline_connection_internal')
|
||||
do('sdp_unregister_service_internal')
|
17
tool/misc/fix_void_declarations.cocci
Normal file
17
tool/misc/fix_void_declarations.cocci
Normal file
@ -0,0 +1,17 @@
|
||||
// prototype
|
||||
@@
|
||||
identifier fn;
|
||||
type t;
|
||||
@@
|
||||
- t fn();
|
||||
+ t fn(void);
|
||||
|
||||
// implementation
|
||||
@@
|
||||
identifier fn;
|
||||
type t;
|
||||
@@
|
||||
- fn()
|
||||
+ fn(void)
|
||||
{ ... }
|
||||
|
5
tool/misc/replace_bzero_with_memset.cocci
Normal file
5
tool/misc/replace_bzero_with_memset.cocci
Normal file
@ -0,0 +1,5 @@
|
||||
@@
|
||||
expression src, size;
|
||||
@@
|
||||
- bzero(src, size)
|
||||
+ memset(src, 0, size)
|
13
tool/misc/replace_malloc_plus_memset_by_calloc.cocci
Normal file
13
tool/misc/replace_malloc_plus_memset_by_calloc.cocci
Normal file
@ -0,0 +1,13 @@
|
||||
@@
|
||||
expression size, src;
|
||||
@@
|
||||
- src = malloc(size)
|
||||
+ src = calloc(size)
|
||||
...
|
||||
- memset(src, 0, size);
|
||||
|
||||
@@
|
||||
expression size;
|
||||
@@
|
||||
- calloc(size)
|
||||
+ calloc(size, 1)
|
Loading…
x
Reference in New Issue
Block a user