Explorar el Código

fix fprintf

tags/1.0.0
Chris Cromer hace 1 año
padre
commit
9980b9491b
Firmado por: cromer ID de clave GPG: 39CC813FF3C8708A
Se han modificado 2 ficheros con 6 adiciones y 5 borrados
  1. +3
    -2
      src/count_sort.c
  2. +3
    -3
      src/sort.c

+ 3
- 2
src/count_sort.c Ver fichero

@@ -13,6 +13,7 @@
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

@@ -26,12 +27,12 @@ void count_sort(int *array, int n) {
int j;
int *temp = malloc(sizeof(int) * n);
if (temp == NULL) {
fprintf("Error: Out of heap space!\n");
fprintf(stderr, "Error: Out of heap space!\n");
exit(5);
}
int *count = malloc(sizeof(int) * n);
if (count == NULL) {
fprintf("Error: Out of heap space!\n");
fprintf(stderr, "Error: Out of heap space!\n");
exit(5);
}
memcpy(temp, array, sizeof(int) * n);


+ 3
- 3
src/sort.c Ver fichero

@@ -83,7 +83,7 @@ int read_buffer(int *variable) {
}
char **check = malloc(sizeof(char**));
if (check == NULL) {
fprintf("Error: Out of heap space!\n");
fprintf(stderr, "Error: Out of heap space!\n");
exit(5);
}
long input = strtol(buffer, check, 10);
@@ -203,12 +203,12 @@ int main (int argc, char **argv) {

unordered_array = malloc(sizeof(int) * n);
if (unordered_array == NULL) {
fprintf("Error: Out of heap space!\n");
fprintf(stderr, "Error: Out of heap space!\n");
exit(5);
}
work_array = malloc(sizeof(int) * n);
if (work_array == NULL) {
fprintf("Error: Out of heap space!\n");
fprintf(stderr, "Error: Out of heap space!\n");
exit(5);
}
atexit(cleanup);


Cargando…
Cancelar
Guardar