Skip to main content
deleted 62 characters in body
Source Link
Roland Illig
  • 21.9k
  • 2
  • 36
  • 84

I am missing calls to free in the opendir/readdir code, and youYou should let your code be indented automatically. One of the if statements is indented too far.

I prefer the first variant, because you don't need to allocate the memory for the whole directory at once. And, as soon as the count is larger than 46, you can break out of the loop and return immediately.

I am missing calls to free in the opendir/readdir code, and you should let your code be indented automatically. One of the if statements is indented too far.

I prefer the first variant, because you don't need to allocate the memory for the whole directory at once. And, as soon as the count is larger than 46, you can break out of the loop and return immediately.

You should let your code be indented automatically. One of the if statements is indented too far.

I prefer the first variant, because you don't need to allocate the memory for the whole directory at once. And, as soon as the count is larger than 46, you can break out of the loop and return immediately.

Source Link
Roland Illig
  • 21.9k
  • 2
  • 36
  • 84

I am missing calls to free in the opendir/readdir code, and you should let your code be indented automatically. One of the if statements is indented too far.

I prefer the first variant, because you don't need to allocate the memory for the whole directory at once. And, as soon as the count is larger than 46, you can break out of the loop and return immediately.