Merge branch 'const' into 'master'

retain const qualifier from pointer

See merge request pulseaudio/pulseaudio!863
This commit is contained in:
Rudi Heitbaum 2026-02-07 16:53:40 +11:00
commit 38f8bcbea6
9 changed files with 22 additions and 17 deletions

View file

@ -165,6 +165,7 @@ static void resolver_cb(
struct userdata *u = userdata; struct userdata *u = userdata;
struct tunnel *tnl; struct tunnel *tnl;
char *device = NULL, *nicename, *dname, *vname, *args; char *device = NULL, *nicename, *dname, *vname, *args;
const char *nicename2;
char *tp = NULL, *et = NULL, *cn = NULL; char *tp = NULL, *et = NULL, *cn = NULL;
char *ch = NULL, *ss = NULL, *sr = NULL; char *ch = NULL, *ss = NULL, *sr = NULL;
char *dm = NULL; char *dm = NULL;
@ -183,10 +184,10 @@ static void resolver_cb(
goto finish; goto finish;
} }
if ((nicename = strstr(name, "@"))) { if ((nicename2 = strstr(name, "@"))) {
++nicename; ++nicename2;
if (strlen(nicename) > 0) { if (strlen(nicename2) > 0) {
pa_log_debug("Found RAOP: %s", nicename); pa_log_debug("Found RAOP: %s", nicename2);
nicename = pa_escape(nicename, "\"'"); nicename = pa_escape(nicename, "\"'");
} else } else
nicename = NULL; nicename = NULL;

View file

@ -311,8 +311,8 @@ char *pa_get_binary_name(char *s, size_t l) {
return NULL; return NULL;
} }
char *pa_path_get_filename(const char *p) { const char *pa_path_get_filename(const char *p) {
char *fn; const char *fn;
if (!p) if (!p)
return NULL; return NULL;
@ -320,7 +320,7 @@ char *pa_path_get_filename(const char *p) {
if ((fn = strrchr(p, PA_PATH_SEP_CHAR))) if ((fn = strrchr(p, PA_PATH_SEP_CHAR)))
return fn+1; return fn+1;
return (char*) p; return p;
} }
char *pa_get_fqdn(char *s, size_t l) { char *pa_get_fqdn(char *s, size_t l) {

View file

@ -49,7 +49,7 @@ char *pa_get_binary_name(char *s, size_t l);
/** Return a pointer to the filename inside a path (which is the last /** Return a pointer to the filename inside a path (which is the last
* component). If passed NULL will return NULL. */ * component). If passed NULL will return NULL. */
char *pa_path_get_filename(const char *p); const char *pa_path_get_filename(const char *p);
/** Wait t milliseconds */ /** Wait t milliseconds */
int pa_msleep(unsigned long t); int pa_msleep(unsigned long t);

View file

@ -105,7 +105,8 @@ char *pa_xstrdup(const char *s) {
} }
char *pa_xstrndup(const char *s, size_t l) { char *pa_xstrndup(const char *s, size_t l) {
char *e, *r; const char *e;
char *r;
if (!s) if (!s)
return NULL; return NULL;

View file

@ -45,7 +45,7 @@ static char *parse_host(const char *s, uint16_t *ret_port) {
pa_assert(ret_port); pa_assert(ret_port);
if (*s == '[') { if (*s == '[') {
char *e; const char *e;
if (!(e = strchr(s+1, ']'))) if (!(e = strchr(s+1, ']')))
return NULL; return NULL;
@ -61,7 +61,7 @@ static char *parse_host(const char *s, uint16_t *ret_port) {
return pa_xstrndup(s+1, (size_t) (e-s-1)); return pa_xstrndup(s+1, (size_t) (e-s-1));
} else { } else {
char *e; const char *e;
uint32_t p; uint32_t p;
if (!(e = strrchr(s, ':'))) if (!(e = strrchr(s, ':')))

View file

@ -741,7 +741,8 @@ enum {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
pa_mainloop* m = NULL; pa_mainloop* m = NULL;
int ret = 1, c; int ret = 1, c;
char *bn, *server = NULL; const char *bn;
char *server = NULL;
pa_time_event *time_event = NULL; pa_time_event *time_event = NULL;
const char *filename = NULL; const char *filename = NULL;
/* type for pa_read/_write. passed as userdata to the callbacks */ /* type for pa_read/_write. passed as userdata to the callbacks */
@ -1046,7 +1047,7 @@ int main(int argc, char *argv[]) {
} }
if (file_format <= 0) { if (file_format <= 0) {
char *extension; const char *extension;
if (filename && (extension = strrchr(filename, '.'))) if (filename && (extension = strrchr(filename, '.')))
file_format = pa_sndfile_format_from_string(extension+1); file_format = pa_sndfile_format_from_string(extension+1);
if (file_format <= 0) if (file_format <= 0)

View file

@ -103,7 +103,7 @@ int main(int argc, char*argv[]) {
struct pollfd *watch_socket, *watch_stdin, *watch_stdout; struct pollfd *watch_socket, *watch_stdin, *watch_stdout;
int stdin_type = 0, stdout_type = 0, fd_type = 0; int stdin_type = 0, stdout_type = 0, fd_type = 0;
char *bn = NULL; const char *bn = NULL;
int c; int c;
static const struct option long_options[] = { static const struct option long_options[] = {

View file

@ -2732,7 +2732,8 @@ enum {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
pa_mainloop *m = NULL; pa_mainloop *m = NULL;
int ret = 1, c; int ret = 1, c;
char *server = NULL, *opt_format = NULL, *bn; const char *bn;
char *server = NULL, *opt_format = NULL;
static const struct option long_options[] = { static const struct option long_options[] = {
{"server", 1, NULL, 's'}, {"server", 1, NULL, 's'},
@ -2848,7 +2849,7 @@ int main(int argc, char *argv[]) {
if (optind+2 < argc) if (optind+2 < argc)
sample_name = pa_xstrdup(argv[optind+2]); sample_name = pa_xstrdup(argv[optind+2]);
else { else {
char *f = pa_path_get_filename(argv[optind+1]); const char *f = pa_path_get_filename(argv[optind+1]);
sample_name = pa_xstrndup(f, strcspn(f, ".")); sample_name = pa_xstrndup(f, strcspn(f, "."));
} }

View file

@ -240,7 +240,8 @@ enum {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
pa_mainloop* m = NULL; pa_mainloop* m = NULL;
int c, ret = 1; int c, ret = 1;
char *server = NULL, *bn; const char *bn;
char *server = NULL;
static const struct option long_options[] = { static const struct option long_options[] = {
{"server", 1, NULL, 's'}, {"server", 1, NULL, 's'},