mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-21 09:36:24 +00:00
Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.
In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.
The script I ran for the src directory is added as build-scripts/clang-format-src.sh
This fixes:
#6592
#6593
#6594
(cherry picked from commit 5750bcb174)
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* for srand() */
|
||||
#include <time.h> /* for time() */
|
||||
#include <time.h> /* for time() */
|
||||
|
||||
#include "testnative.h"
|
||||
#include "testutils.h"
|
||||
@@ -53,8 +53,7 @@ quit(int rc)
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
void
|
||||
MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite)
|
||||
void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
|
||||
{
|
||||
int sprite_w, sprite_h;
|
||||
int i;
|
||||
@@ -92,8 +91,7 @@ MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite)
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i, done;
|
||||
const char *driver;
|
||||
@@ -109,7 +107,7 @@ main(int argc, char *argv[])
|
||||
|
||||
if (SDL_VideoInit(NULL) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video: %s\n",
|
||||
SDL_GetError());
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
driver = SDL_GetCurrentVideoDriver();
|
||||
@@ -123,7 +121,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
if (factory == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find native window code for %s driver\n",
|
||||
driver);
|
||||
driver);
|
||||
quit(2);
|
||||
}
|
||||
SDL_Log("Creating native window for %s driver\n", driver);
|
||||
@@ -158,8 +156,8 @@ main(int argc, char *argv[])
|
||||
/* Allocate memory for the sprite info */
|
||||
SDL_GetWindowSize(window, &window_w, &window_h);
|
||||
SDL_QueryTexture(sprite, NULL, NULL, &sprite_w, &sprite_h);
|
||||
positions = (SDL_Rect *) SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect));
|
||||
velocities = (SDL_Rect *) SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect));
|
||||
positions = (SDL_Rect *)SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect));
|
||||
velocities = (SDL_Rect *)SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect));
|
||||
if (positions == NULL || velocities == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
|
||||
quit(2);
|
||||
|
||||
Reference in New Issue
Block a user