! fwrite_orDie() : * * Write sizeToWrite bytes to a file pointed to by file, obtaining * them from a location given by buffer. * * Note: This function will send an error to stderr and exit if it * cannot write data to the given file pointer. * * @return The number of bytes written. */
| 144 | * @return The number of bytes written. |
| 145 | */ |
| 146 | static size_t fwrite_orDie(const void* buffer, size_t sizeToWrite, FILE* file) |
| 147 | { |
| 148 | size_t const writtenSize = fwrite(buffer, 1, sizeToWrite, file); |
| 149 | if (writtenSize == sizeToWrite) return sizeToWrite; /* good */ |
| 150 | /* error */ |
| 151 | perror("fwrite"); |
| 152 | exit(ERROR_fwrite); |
| 153 | } |
| 154 | |
| 155 | /*! malloc_orDie() : |
| 156 | * Allocate memory. |
no outgoing calls
no test coverage detected