changeset 66:a0f0ad5e42eb

[Misc] taking out capital P stuff.
author June Park <parkjune1995@gmail.com>
date Wed, 24 Dec 2025 06:34:19 -0800
parents ecb6ee6a22c3
children 6626ec933933
files gara/main.c seobeo/os/s_linux_edge.c seobeo/os/s_macos_edge.c seobeo/s_linux_network.c seobeo/s_web.c seobeo/seobeo.h seobeo/seobeo_internal.h
diffstat 7 files changed, 42 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/gara/main.c	Wed Dec 24 06:22:59 2025 -0800
+++ b/gara/main.c	Wed Dec 24 06:34:19 2025 -0800
@@ -1,7 +1,7 @@
 #include "seobeo/seobeo.h"
 #include "stdio.h"
 
-void HandleClientRequest(Seobeo_PHandle p_cli_handle) {
+void HandleClientRequest(Seobeo_Handle *p_cli_handle) {
   char *hello = "Hello good sir";
   Seobeo_Handle_Queue(p_cli_handle, (uint8_t*)hello, 14);
   Seobeo_Handle_Flush(p_cli_handle);
@@ -22,12 +22,12 @@
 
   printf("Server initializing\n");
   const char *PORT = "3322";
-  Seobeo_PHandle server = Seobeo_Stream_Handle_Server_Create(NULL,  PORT);
+  Seobeo_Handle *server = Seobeo_Stream_Handle_Server_Create(NULL,  PORT);
 
   printf("Server running\n");
   while (1)
   {
-    Seobeo_PHandle p_cli_handle =
+    Seobeo_Handle *p_cli_handle =
       Seobeo_Stream_Handle_Server_Accept(server);
     if (!p_cli_handle) continue;
 
--- a/seobeo/os/s_linux_edge.c	Wed Dec 24 06:22:59 2025 -0800
+++ b/seobeo/os/s_linux_edge.c	Wed Dec 24 06:34:19 2025 -0800
@@ -35,12 +35,12 @@
     }
 
     for (int i = 0; i < n; i++) {
-      Seobeo_PHandle phandle = events[i].data.ptr;
+      Seobeo_Handle *phandle = events[i].data.ptr;
 
       if (phandle == args->srv) {
         // Accept all pending connections (edge-triggered mode)
         while (1) {
-          Seobeo_PHandle p_cli_handle = Seobeo_Stream_Handle_Server_Accept(args->srv);
+          Seobeo_Handle *p_cli_handle = Seobeo_Stream_Handle_Server_Accept(args->srv);
           if (!p_cli_handle) break;
 
           struct epoll_event client_ev = {
@@ -68,7 +68,7 @@
 }
 
 void Seobeo_Web_Edge(
-    Seobeo_PHandle p_server_handle,
+    Seobeo_Handle *p_server_handle,
     int thread_count,
     Dowa_HashMap *p_html_cache)
 {
@@ -93,7 +93,7 @@
 }
 
 
-void Seobeo_Web_Edge_2(Seobeo_PHandle p_handle_server, Dowa_HashMap *cache)
+void Seobeo_Web_Edge_2(Seobeo_Handle *p_handle_server, Dowa_HashMap *cache)
 {
   const int MAX_EVENTS = 1024;
   struct epoll_event events[MAX_EVENTS];
@@ -138,7 +138,7 @@
       {
         while (1)
         {
-          Seobeo_PHandle p_handle_client = Seobeo_Stream_Handle_Server_Accept(p_handle_server);
+          Seobeo_Handle *p_handle_client = Seobeo_Stream_Handle_Server_Accept(p_handle_server);
           if (!p_handle_client) break;
 
           struct epoll_event client_ev = {
@@ -161,7 +161,7 @@
       }
 
       snprintf(keybuf, sizeof(keybuf), "%d", fd);
-      Seobeo_PHandle p_handle_client = Dowa_HashMap_Get(handles, keybuf);
+      Seobeo_Handle *p_handle_client = Dowa_HashMap_Get(handles, keybuf);
       if (!p_handle_client)
       {
         // might happen if client closed between event and lookup
--- a/seobeo/os/s_macos_edge.c	Wed Dec 24 06:22:59 2025 -0800
+++ b/seobeo/os/s_macos_edge.c	Wed Dec 24 06:34:19 2025 -0800
@@ -34,12 +34,12 @@
 
     for (int i = 0; i < ne; i++)
     {
-      Seobeo_PHandle h = evlist[i].udata;
+      Seobeo_Handle *h = evlist[i].udata;
       if (h == args->srv)
       {
         // Accept new connections in a loop (for edge-triggered behavior)
         while (1) {
-          Seobeo_PHandle cli = Seobeo_Stream_Handle_Server_Accept(args->srv);
+          Seobeo_Handle *cli = Seobeo_Stream_Handle_Server_Accept(args->srv);
           if (!cli) break;
 
           struct kevent client_kev = {
@@ -70,7 +70,7 @@
 }
 
 void  Seobeo_Web_Edge(
-    Seobeo_PHandle p_server_handle,
+    Seobeo_Handle *p_server_handle,
     int            thread_count,
     Dowa_HashMap  *p_html_cache)
 {
--- a/seobeo/s_linux_network.c	Wed Dec 24 06:22:59 2025 -0800
+++ b/seobeo/s_linux_network.c	Wed Dec 24 06:34:19 2025 -0800
@@ -1,9 +1,9 @@
 #include "seobeo/seobeo.h"
 
 
-Seobeo_PHandle Seobeo_Stream_Handle_Server_Create(const char *host,  const char* port)
+Seobeo_Handle *Seobeo_Stream_Handle_Server_Create(const char *host,  const char* port)
 {
-  Seobeo_PHandle p_handle;
+  Seobeo_Handle *p_handle;
   struct addrinfo hints, *server_infos, *free_server_info;
   int32 socket_fd, yes = 1;  // Need this for setsockopt 
 
@@ -79,9 +79,9 @@
 }
 
 
-Seobeo_PHandle Seobeo_Stream_Handle_Client_Create(const char *host,  const char* port, boolean use_tls)
+Seobeo_Handle *Seobeo_Stream_Handle_Client_Create(const char *host,  const char* port, boolean use_tls)
 {
-  Seobeo_PHandle p_handle;
+  Seobeo_Handle *p_handle;
   p_handle = malloc(sizeof(*p_handle));
 
   struct addrinfo hints, *server_infos;
@@ -148,7 +148,7 @@
   return p_handle;
 }
 
-Seobeo_PHandle Seobeo_Stream_Handle_Server_Accept(Seobeo_PHandle p_server_handle)
+Seobeo_Handle *Seobeo_Stream_Handle_Server_Accept(Seobeo_Handle *p_server_handle)
 {
   struct sockaddr_storage addr;
   socklen_t addrlen = sizeof addr;
@@ -168,7 +168,7 @@
   if (flags == -1) return NULL;
   fcntl(client_fd, F_SETFL, flags | O_NONBLOCK);
 
-  Seobeo_PHandle p_client_handle        = malloc(sizeof *p_client_handle);
+  Seobeo_Handle *p_client_handle        = malloc(sizeof *p_client_handle);
 
   p_client_handle->socket               = client_fd;
   p_client_handle->type                 = SEOBEO_STREAM_TYPE_CLIENT;
@@ -198,7 +198,7 @@
   return p_client_handle;
 }
 
-void Seobeo_Handle_Destroy(Seobeo_PHandle p_handle)
+void Seobeo_Handle_Destroy(Seobeo_Handle *p_handle)
 {
   if (!p_handle) return;
 
@@ -237,7 +237,7 @@
 }
 
 
-int32 Seobeo_Handle_Flush(Seobeo_PHandle p_handle)
+int32 Seobeo_Handle_Flush(Seobeo_Handle *p_handle)
 {
   uint32 total = p_handle->write_buffer_len;
   uint32 sent  = 0;
@@ -282,7 +282,7 @@
   return 0;
 }
 
-int32 Seobeo_Handle_Queue(Seobeo_PHandle p_handle, const uint8 *data, uint32 data_size)
+int32 Seobeo_Handle_Queue(Seobeo_Handle *p_handle, const uint8 *data, uint32 data_size)
 {
   if (p_handle->write_buffer_len + data_size > p_handle->write_buffer_capacity)
   {
@@ -352,7 +352,7 @@
   return 0;
 }
 
-int32 Seobeo_Handle_Read(Seobeo_PHandle p_handle)
+int32 Seobeo_Handle_Read(Seobeo_Handle *p_handle)
 {
   int32 read_size;
   if (!p_handle) return -1;
@@ -397,7 +397,7 @@
   return read_size;
 }
 
-void Seobeo_Handle_Consume(Seobeo_PHandle p_handle, uint32 consumed)
+void Seobeo_Handle_Consume(Seobeo_Handle *p_handle, uint32 consumed)
 {
   if (consumed >= p_handle->read_buffer_len)
   {
--- a/seobeo/s_web.c	Wed Dec 24 06:22:59 2025 -0800
+++ b/seobeo/s_web.c	Wed Dec 24 06:34:19 2025 -0800
@@ -55,7 +55,7 @@
   );
 }
 
-void Seobeo_Web_HandleClientRequest(Seobeo_PHandle  p_cli_handle,
+void Seobeo_Web_HandleClientRequest(Seobeo_Handle  *p_cli_handle,
                                     Dowa_HashMap   *p_html_cache)
 {
   printf("p_cli_handle: %p", p_cli_handle);
@@ -260,7 +260,7 @@
 }
 
 
-int Seobeo_Web_Header_Parse(Seobeo_PHandle p_handle, Dowa_HashMap *map)
+int Seobeo_Web_Header_Parse(Seobeo_Handle *p_handle, Dowa_HashMap *map)
 {
   // 1) Fill read_buffer until we see "\r\n\r\n"
   while (1)
@@ -469,7 +469,7 @@
     return -1;
   }
 
-  Seobeo_PHandle p_server_handle =
+  Seobeo_Handle *p_server_handle =
     Seobeo_Stream_Handle_Server_Create(NULL, port);
   if (p_server_handle->socket < 0) return 1;
 
@@ -487,7 +487,7 @@
 
     while (1)
     {
-      Seobeo_PHandle p_cli_handle =
+      Seobeo_Handle *p_cli_handle =
         Seobeo_Stream_Handle_Server_Accept(p_server_handle);
       if (!p_cli_handle) continue;
 
@@ -514,7 +514,7 @@
                           const char *port,
                           const char *path)
 {
-  Seobeo_PHandle h = Seobeo_Stream_Handle_Client_Create(host, port, TRUE);
+  Seobeo_Handle *h = Seobeo_Stream_Handle_Client_Create(host, port, TRUE);
   if (!h || h->socket < 0)
   {
     if (h)
--- a/seobeo/seobeo.h	Wed Dec 24 06:22:59 2025 -0800
+++ b/seobeo/seobeo.h	Wed Dec 24 06:34:19 2025 -0800
@@ -49,11 +49,11 @@
 
 // --- TCP --- //
 // --- Generate a Server Handle. ---//
-extern Seobeo_PHandle Seobeo_Stream_Handle_Server_Create(const char *host,  const char* port);
+extern Seobeo_Handle *Seobeo_Stream_Handle_Server_Create(const char *host,  const char* port);
 // --- Generate a Client Handle. ---//
-extern Seobeo_PHandle Seobeo_Stream_Handle_Client_Create(const char *host,  const char* port, boolean use_tls);
+extern Seobeo_Handle *Seobeo_Stream_Handle_Client_Create(const char *host,  const char* port, boolean use_tls);
 // --- Generate a Client Handle from given Server Handle. ---//
-extern Seobeo_PHandle Seobeo_Stream_Handle_Server_Accept(Seobeo_PHandle p_server_handle);
+extern Seobeo_Handle *Seobeo_Stream_Handle_Server_Accept(Seobeo_Handle *p_server_handle);
 
 // --- Web --- //
 /* Generate HTTP 1.1 Header value with given content_types and length. */
@@ -65,15 +65,15 @@
 
 // --- Helper functions --- //
 /* Destroy handle. It will handle all NULL poointers. */
-extern void           Seobeo_Handle_Destroy(Seobeo_PHandle p_handle);
+extern void           Seobeo_Handle_Destroy(Seobeo_Handle *p_handle);
 /* Write to socket from write_buffer in the handle. */
-extern int            Seobeo_Handle_Flush(Seobeo_PHandle p_handle); 
+extern int            Seobeo_Handle_Flush(Seobeo_Handle *p_handle); 
 /* Write to socket with given data source, if the data source is bigger than the write buffer for handle then we just directly write from the data source. */
-extern int            Seobeo_Handle_Queue(Seobeo_PHandle p_handle, const uint8_t *data, uint32_t data_size); 
+extern int            Seobeo_Handle_Queue(Seobeo_Handle *p_handle, const uint8_t *data, uint32_t data_size); 
 /* Read to socket from read_buffer in the handle. */
-extern int            Seobeo_Handle_Read(Seobeo_PHandle p_handle); 
+extern int            Seobeo_Handle_Read(Seobeo_Handle *p_handle); 
 /* Move to read_buffer to front and we already consumed the given amount in the handle. */
-extern void           Seobeo_Handle_Consume(Seobeo_PHandle p_handle, uint32 consumed);
+extern void           Seobeo_Handle_Consume(Seobeo_Handle *p_handle, uint32 consumed);
 /* Assign IP4 or IP6 to sockaddr. TODO: Maybe create my own struct for this? */
 extern void           *Seobeo_Get_IP4_Or_IP6(struct sockaddr *sa);
 #endif
--- a/seobeo/seobeo_internal.h	Wed Dec 24 06:22:59 2025 -0800
+++ b/seobeo/seobeo_internal.h	Wed Dec 24 06:34:19 2025 -0800
@@ -40,10 +40,10 @@
   char        *file_name;
 
   atomic_bool destroyed;
-} Sebeo_Handle, *Seobeo_PHandle;
+} Seobeo_Handle;
 
 typedef struct {
-  Seobeo_PHandle  srv;
+  Seobeo_Handle  *srv;
   Dowa_HashMap   *cache;
 } WorkerArgs;
 
@@ -56,10 +56,10 @@
 
 
 // --- Parse Header into Dowa Map ---//
-extern int            Seobeo_Web_Header_Parse(Seobeo_PHandle p_handle, Dowa_HashMap *map);
+extern int            Seobeo_Web_Header_Parse(Seobeo_Handle *p_handle, Dowa_HashMap *map);
 
 // --- Handle Request --- //
-extern void           Seobeo_Web_HandleClientRequest(Seobeo_PHandle cli, Dowa_HashMap *p_html_cache);
+extern void           Seobeo_Web_HandleClientRequest(Seobeo_Handle *cli, Dowa_HashMap *p_html_cache);
 
 // --- SSL --- //
 extern void           Seobeo_Web_SSL_Init();
@@ -67,8 +67,8 @@
 
 // --- Serving using Edge --- //
 extern void          *Seobeo_Web_Edge_Worker(void *vargs); 
-extern void           Seobeo_Web_Edge(Seobeo_PHandle p_server_handle, int thread_count, Dowa_HashMap *p_html_cache);
-extern void           Seobeo_Web_Edge_2(Seobeo_PHandle p_server_handle, Dowa_HashMap *p_html_cache);
+extern void           Seobeo_Web_Edge(Seobeo_Handle *p_server_handle, int thread_count, Dowa_HashMap *p_html_cache);
+extern void           Seobeo_Web_Edge_2(Seobeo_Handle *p_server_handle, Dowa_HashMap *p_html_cache);
 
 #endif