mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-10-29 05:40:27 -04:00 
			
		
		
		
	spa: remove unnecessary indirection for some spa_log_topics
				
					
				
			This results in shorter machine code since it removes one pointer load and a NULL check.
This commit is contained in:
		
							parent
							
								
									d2b5b53c08
								
							
						
					
					
						commit
						8256a2d5a6
					
				
					 13 changed files with 39 additions and 35 deletions
				
			
		|  | @ -9,6 +9,8 @@ | |||
| #include <spa/support/plugin.h> | ||||
| #include <spa/support/log.h> | ||||
| 
 | ||||
| #include "alsa.h" | ||||
| 
 | ||||
| extern const struct spa_handle_factory spa_alsa_source_factory; | ||||
| extern const struct spa_handle_factory spa_alsa_sink_factory; | ||||
| extern const struct spa_handle_factory spa_alsa_udev_factory; | ||||
|  | @ -20,8 +22,7 @@ extern const struct spa_handle_factory spa_alsa_compress_offload_sink_factory; | |||
| extern const struct spa_handle_factory spa_alsa_compress_offload_device_factory; | ||||
| #endif | ||||
| 
 | ||||
| struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.alsa"); | ||||
| struct spa_log_topic *alsa_log_topic = &log_topic; | ||||
| struct spa_log_topic alsa_log_topic = SPA_LOG_TOPIC(0, "spa.alsa"); | ||||
| 
 | ||||
| SPA_EXPORT | ||||
| int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index) | ||||
|  |  | |||
|  | @ -8,12 +8,12 @@ | |||
| #include <spa/support/log.h> | ||||
| 
 | ||||
| #undef SPA_LOG_TOPIC_DEFAULT | ||||
| #define SPA_LOG_TOPIC_DEFAULT alsa_log_topic | ||||
| extern struct spa_log_topic *alsa_log_topic; | ||||
| #define SPA_LOG_TOPIC_DEFAULT &alsa_log_topic | ||||
| extern struct spa_log_topic alsa_log_topic; | ||||
| 
 | ||||
| static inline void alsa_log_topic_init(struct spa_log *log) | ||||
| { | ||||
| 	spa_log_topic_init(log, alsa_log_topic); | ||||
| 	spa_log_topic_init(log, &alsa_log_topic); | ||||
| } | ||||
| 
 | ||||
| #endif /* SPA_ALSA_H */ | ||||
|  |  | |||
|  | @ -26,8 +26,8 @@ | |||
| #include <spa/debug/log.h> | ||||
| 
 | ||||
| #undef SPA_LOG_TOPIC_DEFAULT | ||||
| #define SPA_LOG_TOPIC_DEFAULT log_topic | ||||
| static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audioadapter"); | ||||
| #define SPA_LOG_TOPIC_DEFAULT &log_topic | ||||
| static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.audioadapter"); | ||||
| 
 | ||||
| #define DEFAULT_ALIGN	16 | ||||
| 
 | ||||
|  | @ -1755,7 +1755,7 @@ impl_init(const struct spa_handle_factory *factory, | |||
| 	this = (struct impl *) handle; | ||||
| 
 | ||||
| 	this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); | ||||
| 	spa_log_topic_init(this->log, log_topic); | ||||
| 	spa_log_topic_init(this->log, &log_topic); | ||||
| 
 | ||||
| 	this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); | ||||
| 
 | ||||
|  |  | |||
|  | @ -36,8 +36,8 @@ | |||
| #include "wavfile.h" | ||||
| 
 | ||||
| #undef SPA_LOG_TOPIC_DEFAULT | ||||
| #define SPA_LOG_TOPIC_DEFAULT log_topic | ||||
| static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audioconvert"); | ||||
| #define SPA_LOG_TOPIC_DEFAULT &log_topic | ||||
| static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.audioconvert"); | ||||
| 
 | ||||
| #define DEFAULT_RATE		48000 | ||||
| #define DEFAULT_CHANNELS	2 | ||||
|  | @ -3354,7 +3354,7 @@ impl_init(const struct spa_handle_factory *factory, | |||
| 	this = (struct impl *) handle; | ||||
| 
 | ||||
| 	this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); | ||||
| 	spa_log_topic_init(this->log, log_topic); | ||||
| 	spa_log_topic_init(this->log, &log_topic); | ||||
| 
 | ||||
| 	this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); | ||||
| 	if (this->cpu) { | ||||
|  |  | |||
|  | @ -23,8 +23,8 @@ | |||
| #include "mix-ops.h" | ||||
| 
 | ||||
| #undef SPA_LOG_TOPIC_DEFAULT | ||||
| #define SPA_LOG_TOPIC_DEFAULT log_topic | ||||
| static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audiomixer"); | ||||
| #define SPA_LOG_TOPIC_DEFAULT &log_topic | ||||
| static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.audiomixer"); | ||||
| 
 | ||||
| #define DEFAULT_RATE		48000 | ||||
| #define DEFAULT_CHANNELS	2 | ||||
|  | @ -918,7 +918,7 @@ impl_init(const struct spa_handle_factory *factory, | |||
| 	this = (struct impl *) handle; | ||||
| 
 | ||||
| 	this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); | ||||
| 	spa_log_topic_init(this->log, log_topic); | ||||
| 	spa_log_topic_init(this->log, &log_topic); | ||||
| 
 | ||||
| 	this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop); | ||||
| 	if (this->data_loop == NULL) { | ||||
|  |  | |||
|  | @ -23,8 +23,8 @@ | |||
| #include "mix-ops.h" | ||||
| 
 | ||||
| #undef SPA_LOG_TOPIC_DEFAULT | ||||
| #define SPA_LOG_TOPIC_DEFAULT log_topic | ||||
| static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.mixer-dsp"); | ||||
| #define SPA_LOG_TOPIC_DEFAULT &log_topic | ||||
| static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.mixer-dsp"); | ||||
| 
 | ||||
| #define MAX_BUFFERS	64 | ||||
| #define MAX_PORTS	512 | ||||
|  | @ -855,7 +855,7 @@ impl_init(const struct spa_handle_factory *factory, | |||
| 	this = (struct impl *) handle; | ||||
| 
 | ||||
| 	this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); | ||||
| 	spa_log_topic_init(this->log, log_topic); | ||||
| 	spa_log_topic_init(this->log, &log_topic); | ||||
| 
 | ||||
| 	this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop); | ||||
| 	if (this->data_loop == NULL) { | ||||
|  |  | |||
|  | @ -7,11 +7,12 @@ | |||
| #include <spa/support/plugin.h> | ||||
| #include <spa/support/log.h> | ||||
| 
 | ||||
| #include "avb.h" | ||||
| 
 | ||||
| extern const struct spa_handle_factory spa_avb_sink_factory; | ||||
| extern const struct spa_handle_factory spa_avb_source_factory; | ||||
| 
 | ||||
| struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.avb"); | ||||
| struct spa_log_topic *avb_log_topic = &log_topic; | ||||
| struct spa_log_topic avb_log_topic = SPA_LOG_TOPIC(0, "spa.avb"); | ||||
| 
 | ||||
| SPA_EXPORT | ||||
| int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index) | ||||
|  |  | |||
|  | @ -8,12 +8,12 @@ | |||
| #include <spa/support/log.h> | ||||
| 
 | ||||
| #undef SPA_LOG_TOPIC_DEFAULT | ||||
| #define SPA_LOG_TOPIC_DEFAULT avb_log_topic | ||||
| extern struct spa_log_topic *avb_log_topic; | ||||
| #define SPA_LOG_TOPIC_DEFAULT &avb_log_topic | ||||
| extern struct spa_log_topic avb_log_topic; | ||||
| 
 | ||||
| static inline void avb_log_topic_init(struct spa_log *log) | ||||
| { | ||||
| 	spa_log_topic_init(log, avb_log_topic); | ||||
| 	spa_log_topic_init(log, &avb_log_topic); | ||||
| } | ||||
| 
 | ||||
| #endif /* SPA_AVB_H */ | ||||
|  |  | |||
|  | @ -9,8 +9,7 @@ | |||
| 
 | ||||
| #include "libcamera.h" | ||||
| 
 | ||||
| struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.libcamera"); | ||||
| struct spa_log_topic *libcamera_log_topic = &log_topic; | ||||
| struct spa_log_topic libcamera_log_topic = SPA_LOG_TOPIC(0, "spa.libcamera"); | ||||
| 
 | ||||
| SPA_EXPORT | ||||
| int spa_handle_factory_enum(const struct spa_handle_factory **factory, | ||||
|  |  | |||
|  | @ -18,12 +18,12 @@ extern const struct spa_handle_factory spa_libcamera_manager_factory; | |||
| extern const struct spa_handle_factory spa_libcamera_device_factory; | ||||
| 
 | ||||
| #undef SPA_LOG_TOPIC_DEFAULT | ||||
| #define SPA_LOG_TOPIC_DEFAULT libcamera_log_topic | ||||
| extern struct spa_log_topic *libcamera_log_topic; | ||||
| #define SPA_LOG_TOPIC_DEFAULT &libcamera_log_topic | ||||
| extern struct spa_log_topic libcamera_log_topic; | ||||
| 
 | ||||
| static inline void libcamera_log_topic_init(struct spa_log *log) | ||||
| { | ||||
| 	spa_log_topic_init(log, libcamera_log_topic); | ||||
| 	spa_log_topic_init(log, &libcamera_log_topic); | ||||
| } | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
|  |  | |||
|  | @ -7,12 +7,13 @@ | |||
| #include <spa/support/plugin.h> | ||||
| #include <spa/support/log.h> | ||||
| 
 | ||||
| #include "v4l2.h" | ||||
| 
 | ||||
| extern const struct spa_handle_factory spa_v4l2_source_factory; | ||||
| extern const struct spa_handle_factory spa_v4l2_udev_factory; | ||||
| extern const struct spa_handle_factory spa_v4l2_device_factory; | ||||
| 
 | ||||
| struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.v4l2"); | ||||
| struct spa_log_topic *v4l2_log_topic = &log_topic; | ||||
| struct spa_log_topic v4l2_log_topic = SPA_LOG_TOPIC(0, "spa.v4l2"); | ||||
| 
 | ||||
| SPA_EXPORT | ||||
| int spa_handle_factory_enum(const struct spa_handle_factory **factory, | ||||
|  |  | |||
|  | @ -4,15 +4,17 @@ | |||
| 
 | ||||
| #include <errno.h> | ||||
| 
 | ||||
| #include <linux/videodev2.h> | ||||
| 
 | ||||
| #include <spa/support/log.h> | ||||
| 
 | ||||
| #undef SPA_LOG_TOPIC_DEFAULT | ||||
| #define SPA_LOG_TOPIC_DEFAULT v4l2_log_topic | ||||
| extern struct spa_log_topic *v4l2_log_topic; | ||||
| #define SPA_LOG_TOPIC_DEFAULT &v4l2_log_topic | ||||
| extern struct spa_log_topic v4l2_log_topic; | ||||
| 
 | ||||
| static inline void v4l2_log_topic_init(struct spa_log *log) | ||||
| { | ||||
| 	spa_log_topic_init(log, v4l2_log_topic); | ||||
| 	spa_log_topic_init(log, &v4l2_log_topic); | ||||
| } | ||||
| 
 | ||||
| struct spa_v4l2_device { | ||||
|  |  | |||
|  | @ -25,8 +25,8 @@ | |||
| #include <spa/debug/log.h> | ||||
| 
 | ||||
| #undef SPA_LOG_TOPIC_DEFAULT | ||||
| #define SPA_LOG_TOPIC_DEFAULT log_topic | ||||
| static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.videoadapter"); | ||||
| #define SPA_LOG_TOPIC_DEFAULT &log_topic | ||||
| static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.videoadapter"); | ||||
| 
 | ||||
| #define DEFAULT_ALIGN	16 | ||||
| 
 | ||||
|  | @ -1554,7 +1554,7 @@ impl_init(const struct spa_handle_factory *factory, | |||
| 	this = (struct impl *) handle; | ||||
| 
 | ||||
| 	this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); | ||||
| 	spa_log_topic_init(this->log, log_topic); | ||||
| 	spa_log_topic_init(this->log, &log_topic); | ||||
| 
 | ||||
| 	this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Barnabás Pőcze
						Barnabás Pőcze