Skip to content

Commit 3352996

Browse files
author
git-core
committed
constantify su_context* arg & small cosmetic fixes
1 parent 067da4e commit 3352996

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

activity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static const int VAL_INTEGER = 1;
4444

4545
static const int START_SUCCESS = 0;
4646

47-
int send_intent(struct su_context *ctx,
47+
int send_intent(const struct su_context *ctx,
4848
const char *socket_path, int allow, const char *action)
4949
{
5050
sp<IServiceManager> sm = defaultServiceManager();

db.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323

2424
#include "su.h"
2525

26-
// { int* pint; pint=(int*)data; ++(*pint); }
27-
28-
static sqlite3 *db_init()
26+
static sqlite3 *db_init(void)
2927
{
3028
sqlite3 *db;
3129
int rc;
@@ -41,7 +39,7 @@ static sqlite3 *db_init()
4139
return db;
4240
}
4341

44-
static int db_check(sqlite3 *db, struct su_context *ctx)
42+
static int db_check(sqlite3 *db, const struct su_context *ctx)
4543
{
4644
char sql[4096];
4745
char *zErrmsg;
@@ -86,7 +84,7 @@ static int db_check(sqlite3 *db, struct su_context *ctx)
8684
return allow;
8785
}
8886

89-
int database_check(struct su_context *ctx)
87+
int database_check(const struct su_context *ctx)
9088
{
9189
sqlite3 *db;
9290
int dballow;

su.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static int socket_accept(int serv_fd)
196196
return fd;
197197
}
198198

199-
static int socket_send_request(int fd, struct su_context *ctx)
199+
static int socket_send_request(int fd, const struct su_context *ctx)
200200
{
201201
size_t len;
202202
size_t bin_size, cmd_size;
@@ -268,7 +268,7 @@ static void usage(int status)
268268
exit(status);
269269
}
270270

271-
static void deny(struct su_context *ctx)
271+
static void deny(const struct su_context *ctx)
272272
{
273273
char *cmd = get_command(&ctx->to);
274274

@@ -278,7 +278,7 @@ static void deny(struct su_context *ctx)
278278
exit(EXIT_FAILURE);
279279
}
280280

281-
static void allow(struct su_context *ctx)
281+
static void allow(const struct su_context *ctx)
282282
{
283283
char *arg0;
284284
int argc, err;

su.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,26 @@ enum {
7878
DB_ALLOW
7979
};
8080

81-
extern int database_check(struct su_context *ctx);
81+
extern int database_check(const struct su_context *ctx);
8282

83-
extern int send_intent(struct su_context *ctx,
83+
extern int send_intent(const struct su_context *ctx,
8484
const char *socket_path, int allow, const char *action);
8585

86-
static inline char *get_command(struct su_request *to)
86+
static inline char *get_command(const struct su_request *to)
8787
{
8888
return (to->command) ? to->command : to->shell;
8989
}
9090

9191
#if 0
9292
#undef LOGE
93-
#define LOGE(fmt,args...) fprintf(stderr, fmt , ## args )
93+
#define LOGE(fmt,args...) fprintf(stderr, fmt, ##args)
9494
#undef LOGD
95-
#define LOGD(fmt,args...) fprintf(stderr, fmt , ## args )
95+
#define LOGD(fmt,args...) fprintf(stderr, fmt, ##args)
9696
#undef LOGW
97-
#define LOGW(fmt,args...) fprintf(stderr, fmt , ## args )
97+
#define LOGW(fmt,args...) fprintf(stderr, fmt, ##args)
9898
#endif
9999

100-
#define PLOGE(fmt,args...) LOGE(fmt " failed with %d: %s" , ## args , errno, strerror(errno))
101-
#define PLOGEV(fmt,err,args...) LOGE(fmt " failed with %d: %s" , ## args , err, strerror(err))
100+
#define PLOGE(fmt,args...) LOGE(fmt " failed with %d: %s", ##args, errno, strerror(errno))
101+
#define PLOGEV(fmt,err,args...) LOGE(fmt " failed with %d: %s", ##args, err, strerror(err))
102102

103103
#endif

0 commit comments

Comments
 (0)