Normalize code style to match established conventions

An assistant-written stretch of code had drifted from the conventions the
older hand-written files establish. Sweeps the whole of src/ back into line.

Systematic:
- @returns -> @return (163 occurrences, 84 files). Concentrated in ui/ and
  rpg/cutscene/; the rest of the tree already used @return 646 times.
- Lowercase "null" -> "NULL" in assert/error message strings (170
  occurrences, 28 files), matching the dominant 441-use spelling. Covers
  "cannot be null", "must not be null" and adjectival uses.

Localized:
- sort.c: drop a stray #include <stdlib.h> that sat *above* the copyright
  header, leaving it the only file in the repo without a leading header
  block. Also drops the same redundant include from random.c and npcturn.c
  (dusk.h already pulls in stdlib.h).
- Convert 7 files' license headers from // lines to the /** */ block form.
- cutscenesystem.c: memset -> memoryZero, matching the identical call ~20
  lines further down and the rest of the codebase.
- Struct tags suffixed _t -> _s: threadlock_t -> threadmutex_s (which also
  makes the tag match its typedef) and chunkpos_t -> chunkpos_s.
- Convert 20 inline /* */ block comments to // across the mesh builders,
  assetfile.c and assetlocaleloader.c.
- Pointer truthiness if(!ptr) -> if(ptr == NULL) in 16 places, matching the
  267 existing explicit comparisons. Boolean !x checks are left alone.
- entityanim.h: drop a JSDoc-style type annotation from an @return.
- Document easing.h's 16 undeclared easing functions and
  assetjsonloader.h's 3 loader callbacks.

No behavioral change. Builds clean with no new warnings; ctest shows the
same 6 pre-existing failures as HEAD, verified against a pristine worktree.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
2026-09-07 17:10:32 -05:00
co-authored by Claude Opus 5
parent b3623c84a5
commit 5cf81aa238
136 changed files with 562 additions and 412 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
#include "util/string.h"
errorret_t assetInitPBP(const char_t *pbpPath) {
assertNotNull(pbpPath, "PBP path cannot be null.");
assertNotNull(pbpPath, "PBP path cannot be NULL.");
assertStrLenMin(pbpPath, 1, "PBP path cannot be empty.");
assertStrLenMax(pbpPath, ASSET_PBP_PATH_MAX, "PBP path is too long.");
+2 -2
View File
@@ -35,13 +35,13 @@ typedef struct {
* Initializes the PBP style asset system.
*
* @param pbpPath The file path to the PBP file to read.
* @returns An errorret_t indicating success or failure of the operation.
* @return An errorret_t indicating success or failure of the operation.
*/
errorret_t assetInitPBP(const char_t *pbpPath);
/**
* Disposes the PBP style asset system.
*
* @returns An errorret_t indicating success or failure of the operation.
* @return An errorret_t indicating success or failure of the operation.
*/
errorret_t assetDisposePBP(void);
+2 -2
View File
@@ -15,13 +15,13 @@ typedef assetpbp_t assetpsp_t;
/**
* Initializes the PSP style asset system.
*
* @returns An errorret_t indicating success or failure of the operation.
* @return An errorret_t indicating success or failure of the operation.
*/
errorret_t assetInitPSP(void);
/**
* Disposes the PSP style asset system.
*
* @returns An errorret_t indicating success or failure of the operation.
* @return An errorret_t indicating success or failure of the operation.
*/
errorret_t assetDisposePSP(void);
+9 -9
View File
@@ -16,7 +16,7 @@
#define SAVE_DEVICE_PSP_PATH_MAX 64
errorret_t saveDevicePSPInit(savedevice_t *device) {
assertNotNull(device, "device cannot be null");
assertNotNull(device, "device cannot be NULL");
device->state = SAVE_DEVICE_STATE_UNKNOWN;
@@ -24,13 +24,13 @@ errorret_t saveDevicePSPInit(savedevice_t *device) {
}
errorret_t saveDevicePSPUpdate(savedevice_t *device) {
assertNotNull(device, "device cannot be null");
assertNotNull(device, "device cannot be NULL");
assertIsMainThread("Invalid thread");
errorOk();
}
void saveDevicePSPCheckAvailability(savedevice_t *device) {
assertNotNull(device, "device cannot be null");
assertNotNull(device, "device cannot be NULL");
assertIsMainThread("Invalid thread");
assertTrue(
device->state == SAVE_DEVICE_STATE_CHECKING_AVAILABILITY,
@@ -61,7 +61,7 @@ errorret_t saveDevicePSPGetDataPath(
char_t *dest,
const size_t destSize
) {
assertNotNull(dest, "dest cannot be null");
assertNotNull(dest, "dest cannot be NULL");
stringFormat(
dest, destSize, "%s/%s",
@@ -76,8 +76,8 @@ errorret_t saveDevicePSPDataWrite(
const uint8_t *buffer,
size_t size
) {
assertNotNull(device, "device cannot be null");
assertNotNull(buffer, "buffer cannot be null");
assertNotNull(device, "device cannot be NULL");
assertNotNull(buffer, "buffer cannot be NULL");
char_t finalPath[SAVE_DEVICE_PSP_PATH_MAX];
errorChain(saveDevicePSPGetDataPath(finalPath, sizeof(finalPath)));
@@ -112,9 +112,9 @@ errorret_t saveDevicePSPDataRead(
uint8_t **outBuffer,
size_t *outSize
) {
assertNotNull(device, "device cannot be null");
assertNotNull(outBuffer, "outBuffer cannot be null");
assertNotNull(outSize, "outSize cannot be null");
assertNotNull(device, "device cannot be NULL");
assertNotNull(outBuffer, "outBuffer cannot be NULL");
assertNotNull(outSize, "outSize cannot be NULL");
char_t path[SAVE_DEVICE_PSP_PATH_MAX];
errorChain(saveDevicePSPGetDataPath(path, sizeof(path)));