Home > database >  What does this declaration means? struct Curl_easy *curl_easy_init(void)
What does this declaration means? struct Curl_easy *curl_easy_init(void)

Time:03-15

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....

CodePudding user response:

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.

  • Related