Skip to content

Commit

Permalink
various: sort some standard headers
Browse files Browse the repository at this point in the history
since i was going to fix the include order of stdatomic, might as well
sort the surrouding includes in accordance with the project's coding
style.

some headers can sometime require specific include order. standard
library headers usually don't. but mpv might "hack into" the standard
headers (e.g pthreads) so that complicates things a bit more.

hopefully nothing breaks. if it does, the style guide is to blame.
  • Loading branch information
N-R-K committed Oct 20, 2023
1 parent 0798cfd commit 045cfa9
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 63 deletions.
3 changes: 2 additions & 1 deletion audio/out/ao_coreaudio_exclusive.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
* when you are wanting to do good buffering of audio).
*/

#include <stdatomic.h>

#include <CoreAudio/HostTime.h>

#include <libavutil/intreadwrite.h>
Expand All @@ -43,7 +45,6 @@
#include "internal.h"
#include "audio/format.h"
#include "osdep/timer.h"
#include <stdatomic.h>
#include "options/m_option.h"
#include "common/msg.h"
#include "audio/out/ao_coreaudio_chmap.h"
Expand Down
2 changes: 1 addition & 1 deletion audio/out/ao_jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdatomic.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand All @@ -33,7 +34,6 @@
#include "ao.h"
#include "internal.h"
#include "audio/format.h"
#include <stdatomic.h>
#include "osdep/timer.h"
#include "options/m_config.h"
#include "options/m_option.h"
Expand Down
3 changes: 2 additions & 1 deletion audio/out/ao_wasapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@
#ifndef MP_AO_WASAPI_H_
#define MP_AO_WASAPI_H_

#include <stdatomic.h>
#include <stdlib.h>
#include <stdbool.h>

#include <windows.h>
#include <mmdeviceapi.h>
#include <audioclient.h>
#include <audiopolicy.h>
#include <endpointvolume.h>

#include "common/msg.h"
#include <stdatomic.h>
#include "osdep/windows_utils.h"
#include "internal.h"
#include "ao.h"
Expand Down
4 changes: 2 additions & 2 deletions audio/out/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#ifndef MP_AO_INTERNAL_H_
#define MP_AO_INTERNAL_H_

#include <stdbool.h>
#include <pthread.h>

#include <stdatomic.h>
#include <stdbool.h>

#include "audio/out/ao.h"

/* global data used by ao.c and ao drivers */
Expand Down
10 changes: 5 additions & 5 deletions common/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/

#include <assert.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdatomic.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <pthread.h>
#include <stdint.h>

#include "mpv_talloc.h"

#include "misc/bstr.h"
#include <stdatomic.h>
#include "common/common.h"
#include "common/global.h"
#include "misc/bstr.h"
Expand Down
2 changes: 1 addition & 1 deletion common/stats.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <pthread.h>
#include <stdatomic.h>
#include <time.h>
#include <unistd.h>

Expand All @@ -8,7 +9,6 @@
#include "misc/node.h"
#include "msg.h"
#include "options/m_option.h"
#include <stdatomic.h>
#include "osdep/timer.h"
#include "stats.h"

Expand Down
10 changes: 5 additions & 5 deletions demux/demux.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/

#include <assert.h>
#include <float.h>
#include <limits.h>
#include <pthread.h>
#include <stdatomic.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <limits.h>
#include <pthread.h>
#include <stdint.h>

#include <math.h>

Expand All @@ -42,7 +43,6 @@
#include "common/stats.h"
#include "misc/charset_conv.h"
#include "misc/thread_tools.h"
#include <stdatomic.h>
#include "osdep/timer.h"
#include "osdep/threads.h"

Expand Down
2 changes: 1 addition & 1 deletion filters/f_async_queue.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <limits.h>
#include <pthread.h>
#include <stdatomic.h>

#include "audio/aframe.h"
#include "common/common.h"
#include "common/msg.h"
#include <stdatomic.h>

#include "f_async_queue.h"
#include "filter_internal.h"
Expand Down
2 changes: 1 addition & 1 deletion filters/filter.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <math.h>
#include <pthread.h>
#include <stdatomic.h>

#include <libavutil/hwcontext.h>

#include "common/common.h"
#include "common/global.h"
#include "common/msg.h"
#include <stdatomic.h>
#include "osdep/timer.h"
#include "video/hwdec.h"
#include "video/img_format.h"
Expand Down
4 changes: 2 additions & 2 deletions misc/thread_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
*/

#include <assert.h>
#include <errno.h>
#include <stdatomic.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>

#ifdef __MINGW32__
#include <windows.h>
Expand All @@ -27,7 +28,6 @@

#include "common/common.h"
#include "misc/linked_list.h"
#include <stdatomic.h>
#include "osdep/io.h"
#include "osdep/timer.h"

Expand Down
12 changes: 6 additions & 6 deletions options/m_config_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <pthread.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <assert.h>
#include <stdbool.h>
#include <pthread.h>

#include "m_config_core.h"
#include "options/m_option.h"
Expand All @@ -31,7 +32,6 @@
#include "common/msg.h"
#include "common/msg_control.h"
#include "misc/dispatch.h"
#include <stdatomic.h>

// For use with m_config_cache.
struct m_config_shadow {
Expand Down
12 changes: 6 additions & 6 deletions options/m_config_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/

#include <assert.h>
#include <errno.h>
#include <float.h>
#include <stdlib.h>
#include <pthread.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <assert.h>
#include <stdbool.h>
#include <pthread.h>

#include "libmpv/client.h"

Expand All @@ -36,7 +37,6 @@
#include "common/msg_control.h"
#include "misc/dispatch.h"
#include "misc/node.h"
#include <stdatomic.h>

extern const char mp_help_text[];

Expand Down
4 changes: 2 additions & 2 deletions options/m_config_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

#pragma once

#include <stdatomic.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

#include "common/common.h"
#include "common/global.h"
Expand All @@ -29,7 +30,6 @@
#include "misc/bstr.h"
#include "misc/dispatch.h"
#include "options/m_option.h"
#include <stdatomic.h>

// m_config provides an API to manipulate the config variables in MPlayer.
// It makes use of the Options API to provide a context stack that
Expand Down
10 changes: 5 additions & 5 deletions player/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdatomic.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <math.h>
#include <assert.h>

#include "common/common.h"
#include "common/global.h"
Expand All @@ -39,7 +40,6 @@
#include "options/m_property.h"
#include "options/path.h"
#include "options/parse_configfile.h"
#include <stdatomic.h>
#include "osdep/threads.h"
#include "osdep/timer.h"
#include "osdep/io.h"
Expand Down
3 changes: 1 addition & 2 deletions player/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
#define MPLAYER_MP_CORE_H

#include <pthread.h>
#include <stdbool.h>

#include <stdatomic.h>
#include <stdbool.h>

#include "libmpv/client.h"

Expand Down
3 changes: 2 additions & 1 deletion video/out/cocoa_common.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdatomic.h>

#import <Cocoa/Cocoa.h>
#import <IOKit/pwr_mgt/IOPMLib.h>
#import <IOKit/IOKitLib.h>
Expand All @@ -30,7 +32,6 @@
#import "video/out/cocoa/mpvadapter.h"

#include "osdep/threads.h"
#include <stdatomic.h>
#include "osdep/macosx_compat.h"
#include "osdep/macosx_events_objc.h"

Expand Down
4 changes: 2 additions & 2 deletions video/out/dr_helper.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <stdlib.h>
#include <assert.h>
#include <pthread.h>
#include <stdatomic.h>
#include <stdlib.h>

#include <libavutil/buffer.h>

#include "mpv_talloc.h"
#include "misc/dispatch.h"
#include <stdatomic.h>
#include "video/mp_image.h"

#include "dr_helper.h"
Expand Down
4 changes: 2 additions & 2 deletions video/out/opengl/context_rpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stddef.h>
#include <assert.h>
#include <stdatomic.h>
#include <stddef.h>

#include <bcm_host.h>

#include <EGL/egl.h>
#include <EGL/eglext.h>

#include "common/common.h"
#include <stdatomic.h>
#include "video/out/win_state.h"
#include "context.h"
#include "egl_helpers.h"
Expand Down
10 changes: 5 additions & 5 deletions video/out/vo.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/

#include <assert.h>
#include <math.h>
#include <pthread.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#include <pthread.h>
#include <math.h>

#include "mpv_talloc.h"

#include "config.h"
#include <stdatomic.h>
#include "osdep/timer.h"
#include "osdep/threads.h"
#include "misc/dispatch.h"
Expand Down
12 changes: 6 additions & 6 deletions video/out/vo_libmpv.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <pthread.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
#include <limits.h>
#include <pthread.h>
#include <assert.h>

#include "mpv_talloc.h"
#include "common/common.h"
Expand All @@ -19,7 +20,6 @@
#include "vo.h"
#include "video/mp_image.h"
#include "sub/osd.h"
#include <stdatomic.h>
#include "osdep/timer.h"

#include "common/global.h"
Expand Down
Loading

0 comments on commit 045cfa9

Please sign in to comment.