2
0
Fork 0
forked from zynk/zynk

0.41.2 Move yt_url_encode() docs, document signal globals in zynk.c.

- Moved doc comment block for yt_url_encode() from top of cmd_yt.h
  to immediately before the function definition for better readability.
- Added doc comments to volatile sig_atomic_t running variable describing
  its purpose as main loop control flag and async-signal-safety.
- Added doc comments to start_time variable explaining its role in
  uptime calculation.
- Updated CHANGELOG.md to reflect yt_url_encode() doc comment move.
This commit is contained in:
Johannes Findeisen 2026-07-25 20:16:51 +02:00
commit 11bf7e624d
3 changed files with 29 additions and 14 deletions

View file

@ -3,20 +3,6 @@
#include "zynk.h"
/*
* yt_url_encode - Percent-encode a string for safe use in a URL query parameter.
*
* Encodes all characters except unreserved characters (alphanumerics, '-', '_',
* '.', '~') using RFC 3986 percent-encoding. Used to encode the YouTube video
* URL before embedding it in the oEmbed API request.
*
* Parameters:
* src - The input string to encode.
* dst - Output buffer for the encoded string.
* dstsz - Size of the output buffer.
*
* Returns: void (output is written to dst, NUL-terminated).
*/
/*
* yt_hex_digit - Convert a hexadecimal character to its numeric value.
*
@ -81,6 +67,20 @@ static void yt_decode_unicode_escapes(char *s) {
*w = '\0';
}
/*
* yt_url_encode - Percent-encode a string for safe use in a URL query parameter.
*
* Encodes all characters except unreserved characters (alphanumerics, '-', '_',
* '.', '~') using RFC 3986 percent-encoding. Used to encode the YouTube video
* URL before embedding it in the oEmbed API request.
*
* Parameters:
* src - The input string to encode.
* dst - Output buffer for the encoded string.
* dstsz - Size of the output buffer.
*
* Returns: void (output is written to dst, NUL-terminated).
*/
static void yt_url_encode(const char *src, char *dst, size_t dstsz) {
static const char hex[] = "0123456789ABCDEF";
size_t di = 0;