1
struct Curl_easy *curl_easy_init(void)
{
  CURLcode result;
  struct Curl_easy *data;

  /* Make sure we inited the global SSL stuff */
  if(!initialized) {
    result = curl_global_init(CURL_GLOBAL_DEFAULT);
    if(result) {
      /* something in the global init failed, return nothing */
      DEBUGF(fprintf(stderr, "Error: curl_global_init failed\n"));
      return NULL;
    }
  }

  /* We use curl_open() with undefined URL so far */
  result = Curl_open(&data);
  if(result) {
    DEBUGF(fprintf(stderr, "Error: Curl_open failed\n"));
    return NULL;
  }

  return data;
}

struct Curl_easy *curl_easy_init(void){}

What does this declaration means? Is there any proper keyword can I google about this? I tried Function Pointer Struct, Struct pointer, etc....

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335
Http2inc
  • 19
  • 4
  • [cdecl.org](https://cdecl.org/?q=struct+Curl_easy+*curl_easy_init%28void%29) can sometimes help. But a good book is better. [The Definitive C Book Guide and List](https://stackoverflow.com/q/562303) – 001 Mar 14 '22 at 20:00
  • Wow thx what a helpful site!! – Http2inc Mar 14 '22 at 20:03

1 Answers1

2

This

struct Curl_easy * curl_easy_init(void)

is a declaration of a function with the name curl_easy_init that has the pointer return type struct Curl_easy * and no parameters.

In case of success the function returns the updated pointer

struct Curl_easy *data;

declared within the function. Otherwise the function returns NULL.

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335