misc: collect misc scripts

This commit is contained in:
Matthias Ringwald 2016-04-10 21:53:56 +02:00
parent 724f400dd4
commit 070c8da6de
7 changed files with 80 additions and 0 deletions

View 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)
{ ... }

View 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')

View File

@ -0,0 +1,17 @@
// prototype
@@
identifier fn;
type t;
@@
- t fn();
+ t fn(void);
// implementation
@@
identifier fn;
type t;
@@
- fn()
+ fn(void)
{ ... }

View File

@ -0,0 +1,5 @@
@@
expression src, size;
@@
- bzero(src, size)
+ memset(src, 0, size)

View 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)